Alosa fallax
All filtered SNPS
Pruned filtered SNPS
All unfiltered SNPS
Pruned unfiltered SNPS
Coryphoblennius galerita
All filtered SNPS
Pruned filtered SNPS
All unfiltered SNPS
Pruned unfiltered SNPS
Dicentrarchus labrax
All filtered SNPS
Pruned filtered SNPS
All unfiltered SNPS
Pruned unfiltered SNPS
Hippocampus guttulatus
All filtered SNPS
Pruned filtered SNPS
All unfiltered SNPS
Pruned unfiltered SNPS
Merluccius merluccius
All filtered SNPS
Pruned filtered SNPS
All unfiltered SNPS
Pruned unfiltered SNPS
Mullus surmuletus
All filtered SNPS
Pruned filtered SNPS
All unfiltered SNPS
Pruned unfiltered SNPS
Serranus cabrilla
All filtered SNPS
Pruned filtered SNPS
All unfiltered SNPS
Pruned unfiltered SNPS
Spondyliosoma cantharus
All filtered SNPS
Pruned filtered SNPS
All unfiltered SNPS
Pruned unfiltered SNPS
Symphodus cinereus
All filtered SNPS
Pruned filtered SNPS
All unfiltered SNPS
Pruned unfiltered SNPS
Sarda sarda
All filtered SNPS
Pruned filtered SNPS
All unfiltered SNPS
Pruned unfiltered SNPS
Syngnathus typhle
All filtered SNPS
Pruned filtered SNPS
All unfiltered SNPS
Pruned unfiltered SNPS
stringr viridis viridisLite R.utils R.oo R.methodsS3
"1.4.1" "0.6.2" "0.4.1" "2.11.0" "1.24.0" "1.8.1"
kableExtra formattable png readxl plotly dplyr
"1.3.4" "0.2.1" "0.1-7" "1.3.1" "4.10.0" "1.0.10"
DT leaflet ggsn ggplot2 rnaturalearthdata rnaturalearth
"0.20" "2.1.1" "0.5.0" "3.4.0" "0.1.0" "0.1.0"
sf RColorBrewer rmarkdown flexdashboard
"1.0-2" "1.1-3" "2.11" "0.6.0"
---
title: "PCA"
author: "Pierre Barry"
date: "`r format(Sys.time(), '%d %B, %Y, %H:%M')`"
output:
flexdashboard::flex_dashboard:
theme: paper
orientation: rows
social: menu
source_code: embed
vertical_layout: scroll
self_contained: false
---
```{r global, include=FALSE}
list.of.packages <- c("RColorBrewer","ggplot2","plotly")
for (i in list.of.packages){
if (i %in% installed.packages()[,"Package"] == FALSE){
install.packages(i)
}
eval(bquote(library(.(i))))
}
```
```{r, include = FALSE}
color_med_atl=data.frame(Location=c("Gulf of Lion","Costa Calida","Algarve","Bay of Biscay"),
Col=brewer.pal(n = 4, name = "RdBu"))
```
Alosa fallax {data-navmenu="Species"}
=======================================================================
```{r, include = FALSE}
load(file = paste(path,"/output/pca/Afall_PCA_list.Rdata",sep=""))
```
Row {.tabset data-height=100}
-----------------------
<center>
<font size="6">**Alosa fallax**</font>
</center>
Row {.tabset data-height=50}
-----------------------
<center>
<font size="6">**All filtered SNPS**</font>
</center>
Row {.tabset data-height=600}
-----------------------
### maf = 0
```{r}
pca=PCA_list$All_filtered$maf0[[1]]
data_pca=data.frame(INDIV=pca$sample.id,
PC1=pca$eigenvect[,1],
PC2=pca$eigenvect[,2],
PC3=pca$eigenvect[,3],
PC4=pca$eigenvect[,4],
LOCA=c(rep("Algarve",5),
rep("Bay of Biscay",4),
rep("Gulf of Lion",5),
rep("Costa Calida",0)))
color_med_atl=rev(brewer.pal(n=4,name="RdBu"))
p<-ggplot(data=data_pca,aes(x=PC1,y=PC2,label=INDIV))+
theme_minimal()+
theme(panel.grid=element_blank(),
panel.border=element_rect(fill="transparent"),
plot.title=element_text(hjust=0.5))+
geom_hline(yintercept=0,lty=2)+
geom_vline(xintercept=0,lty=2)+
geom_point(size=3,aes(col=LOCA))+
xlab(paste("PCA 1 (",round(pca$varprop[1]*100,2),"% )",sep=""))+
ylab(paste("PCA 2 (",round(pca$varprop[2]*100,2),"% )",sep=""))+
scale_colour_manual(name="Location",
values=c(color_med_atl[2],
color_med_atl[1],
color_med_atl[3],
color_med_atl[4]))
p1<-p
p<-ggplot(data=data_pca,aes(x=PC3,y=PC4,label=INDIV))+
theme_minimal()+
theme(panel.grid=element_blank(),
panel.border=element_rect(fill="transparent"),
plot.title=element_text(hjust=0.5))+
geom_hline(yintercept=0,lty=2)+
geom_vline(xintercept=0,lty=2)+
geom_point(size=3,aes(col=LOCA))+
xlab(paste("PCA 3 (",round(pca$varprop[3]*100,2),"% )",sep=""))+
ylab(paste("PCA 4 (",round(pca$varprop[4]*100,2),"% )",sep=""))+
scale_colour_manual(name="Location",
values=c(color_med_atl[2],
color_med_atl[1],
color_med_atl[3],
color_med_atl[4]))
p2<-p
data_varpop=data.frame(PC=factor(paste("P",seq(1,10),sep=""),levels=paste("P",seq(1,10),sep="")),VAR=pca$varprop[1:10])
pp<-ggplot(data_varpop,aes(x=PC,y=VAR))+
geom_bar(stat='identity',fill="dodgerblue2",alpha=0.25)+
theme_classic()+
xlab("Principal Component")+
ylab("Variation explained (%)")
```
```{r}
subplot(ggplotly(p1)%>% layout(legend = list(orientation = "h", x = 0.2, y =-0.15)), ggplotly(p2)%>%hide_legend(), ggplotly(pp)%>%hide_legend(), titleX=T,titleY=T,margin=0.035,widths=c(0.375,0.425,0.2),which_layout=1) %>% partial_bundle()
```
### maf = 0.05
```{r}
pca=PCA_list$All_filtered$maf0.05[[1]]
data_pca=data.frame(INDIV=pca$sample.id,
PC1=pca$eigenvect[,1],
PC2=pca$eigenvect[,2],
PC3=pca$eigenvect[,3],
PC4=pca$eigenvect[,4],
LOCA=c(rep("Algarve",5),
rep("Bay of Biscay",4),
rep("Gulf of Lion",5),
rep("Costa Calida",0)))
color_med_atl=rev(brewer.pal(n=4,name="RdBu"))
p<-ggplot(data=data_pca,aes(x=PC1,y=PC2,label=INDIV))+
theme_minimal()+
theme(panel.grid=element_blank(),
panel.border=element_rect(fill="transparent"),
plot.title=element_text(hjust=0.5))+
geom_hline(yintercept=0,lty=2)+
geom_vline(xintercept=0,lty=2)+
geom_point(size=3,aes(col=LOCA))+
xlab(paste("PCA 1 (",round(pca$varprop[1]*100,2),"% )",sep=""))+
ylab(paste("PCA 2 (",round(pca$varprop[2]*100,2),"% )",sep=""))+
scale_colour_manual(name="Location",
values=c(color_med_atl[2],
color_med_atl[1],
color_med_atl[3],
color_med_atl[4]))
p1<-p
p<-ggplot(data=data_pca,aes(x=PC3,y=PC4,label=INDIV))+
theme_minimal()+
theme(panel.grid=element_blank(),
panel.border=element_rect(fill="transparent"),
plot.title=element_text(hjust=0.5))+
geom_hline(yintercept=0,lty=2)+
geom_vline(xintercept=0,lty=2)+
geom_point(size=3,aes(col=LOCA))+
xlab(paste("PCA 3 (",round(pca$varprop[3]*100,2),"% )",sep=""))+
ylab(paste("PCA 4 (",round(pca$varprop[4]*100,2),"% )",sep=""))+
scale_colour_manual(name="Location",
values=c(color_med_atl[2],
color_med_atl[1],
color_med_atl[3],
color_med_atl[4]))
p2<-p
data_varpop=data.frame(PC=factor(paste("P",seq(1,10),sep=""),levels=paste("P",seq(1,10),sep="")),VAR=pca$varprop[1:10])
pp<-ggplot(data_varpop,aes(x=PC,y=VAR))+
geom_bar(stat='identity',fill="dodgerblue2",alpha=0.25)+
theme_classic()+
xlab("Principal Component")+
ylab("Variation explained (%)")
```
```{r}
subplot(ggplotly(p1)%>% layout(legend = list(orientation = "h", x = 0.2, y =-0.15)), ggplotly(p2)%>%hide_legend(), ggplotly(pp)%>%hide_legend(), titleX=T,titleY=T,margin=0.035,widths=c(0.375,0.425,0.2),which_layout=1) %>% partial_bundle()
```
### maf = 0.1
```{r}
pca=PCA_list$All_filtered$maf0.1[[1]]
data_pca=data.frame(INDIV=pca$sample.id,
PC1=pca$eigenvect[,1],
PC2=pca$eigenvect[,2],
PC3=pca$eigenvect[,3],
PC4=pca$eigenvect[,4],
LOCA=c(rep("Algarve",5),
rep("Bay of Biscay",4),
rep("Gulf of Lion",5),
rep("Costa Calida",0)))
color_med_atl=rev(brewer.pal(n=4,name="RdBu"))
p<-ggplot(data=data_pca,aes(x=PC1,y=PC2,label=INDIV))+
theme_minimal()+
theme(panel.grid=element_blank(),
panel.border=element_rect(fill="transparent"),
plot.title=element_text(hjust=0.5))+
geom_hline(yintercept=0,lty=2)+
geom_vline(xintercept=0,lty=2)+
geom_point(size=3,aes(col=LOCA))+
xlab(paste("PCA 1 (",round(pca$varprop[1]*100,2),"% )",sep=""))+
ylab(paste("PCA 2 (",round(pca$varprop[2]*100,2),"% )",sep=""))+
scale_colour_manual(name="Location",
values=c(color_med_atl[2],
color_med_atl[1],
color_med_atl[3],
color_med_atl[4]))
p1<-p
p<-ggplot(data=data_pca,aes(x=PC3,y=PC4,label=INDIV))+
theme_minimal()+
theme(panel.grid=element_blank(),
panel.border=element_rect(fill="transparent"),
plot.title=element_text(hjust=0.5))+
geom_hline(yintercept=0,lty=2)+
geom_vline(xintercept=0,lty=2)+
geom_point(size=3,aes(col=LOCA))+
xlab(paste("PCA 3 (",round(pca$varprop[3]*100,2),"% )",sep=""))+
ylab(paste("PCA 4 (",round(pca$varprop[4]*100,2),"% )",sep=""))+
scale_colour_manual(name="Location",
values=c(color_med_atl[2],
color_med_atl[1],
color_med_atl[3],
color_med_atl[4]))
p2<-p
data_varpop=data.frame(PC=factor(paste("P",seq(1,10),sep=""),levels=paste("P",seq(1,10),sep="")),VAR=pca$varprop[1:10])
pp<-ggplot(data_varpop,aes(x=PC,y=VAR))+
geom_bar(stat='identity',fill="dodgerblue2",alpha=0.25)+
theme_classic()+
xlab("Principal Component")+
ylab("Variation explained (%)")
```
```{r}
subplot(ggplotly(p1)%>% layout(legend = list(orientation = "h", x = 0.2, y =-0.15)), ggplotly(p2)%>%hide_legend(), ggplotly(pp)%>%hide_legend(), titleX=T,titleY=T,margin=0.035,widths=c(0.375,0.425,0.2),which_layout=1) %>% partial_bundle()
```
### maf = 0.15
```{r}
pca=PCA_list$All_filtered$maf0.15[[1]]
data_pca=data.frame(INDIV=pca$sample.id,
PC1=pca$eigenvect[,1],
PC2=pca$eigenvect[,2],
PC3=pca$eigenvect[,3],
PC4=pca$eigenvect[,4],
LOCA=c(rep("Algarve",5),
rep("Bay of Biscay",4),
rep("Gulf of Lion",5),
rep("Costa Calida",0)))
color_med_atl=rev(brewer.pal(n=4,name="RdBu"))
p<-ggplot(data=data_pca,aes(x=PC1,y=PC2,label=INDIV))+
theme_minimal()+
theme(panel.grid=element_blank(),
panel.border=element_rect(fill="transparent"),
plot.title=element_text(hjust=0.5))+
geom_hline(yintercept=0,lty=2)+
geom_vline(xintercept=0,lty=2)+
geom_point(size=3,aes(col=LOCA))+
xlab(paste("PCA 1 (",round(pca$varprop[1]*100,2),"% )",sep=""))+
ylab(paste("PCA 2 (",round(pca$varprop[2]*100,2),"% )",sep=""))+
scale_colour_manual(name="Location",
values=c(color_med_atl[2],
color_med_atl[1],
color_med_atl[3],
color_med_atl[4]))
p1<-p
p<-ggplot(data=data_pca,aes(x=PC3,y=PC4,label=INDIV))+
theme_minimal()+
theme(panel.grid=element_blank(),
panel.border=element_rect(fill="transparent"),
plot.title=element_text(hjust=0.5))+
geom_hline(yintercept=0,lty=2)+
geom_vline(xintercept=0,lty=2)+
geom_point(size=3,aes(col=LOCA))+
xlab(paste("PCA 3 (",round(pca$varprop[3]*100,2),"% )",sep=""))+
ylab(paste("PCA 4 (",round(pca$varprop[4]*100,2),"% )",sep=""))+
scale_colour_manual(name="Location",
values=c(color_med_atl[2],
color_med_atl[1],
color_med_atl[3],
color_med_atl[4]))
p2<-p
data_varpop=data.frame(PC=factor(paste("P",seq(1,10),sep=""),levels=paste("P",seq(1,10),sep="")),VAR=pca$varprop[1:10])
pp<-ggplot(data_varpop,aes(x=PC,y=VAR))+
geom_bar(stat='identity',fill="dodgerblue2",alpha=0.25)+
theme_classic()+
xlab("Principal Component")+
ylab("Variation explained (%)")
```
```{r}
subplot(ggplotly(p1)%>% layout(legend = list(orientation = "h", x = 0.2, y =-0.15)), ggplotly(p2)%>%hide_legend(), ggplotly(pp)%>%hide_legend(), titleX=T,titleY=T,margin=0.035,widths=c(0.375,0.425,0.2),which_layout=1) %>% partial_bundle()
```
### maf = 0.20
```{r}
pca=PCA_list$All_filtered$maf0.2[[1]]
data_pca=data.frame(INDIV=pca$sample.id,
PC1=pca$eigenvect[,1],
PC2=pca$eigenvect[,2],
PC3=pca$eigenvect[,3],
PC4=pca$eigenvect[,4],
LOCA=c(rep("Algarve",5),
rep("Bay of Biscay",4),
rep("Gulf of Lion",5),
rep("Costa Calida",0)))
color_med_atl=rev(brewer.pal(n=4,name="RdBu"))
p<-ggplot(data=data_pca,aes(x=PC1,y=PC2,label=INDIV))+
theme_minimal()+
theme(panel.grid=element_blank(),
panel.border=element_rect(fill="transparent"),
plot.title=element_text(hjust=0.5))+
geom_hline(yintercept=0,lty=2)+
geom_vline(xintercept=0,lty=2)+
geom_point(size=3,aes(col=LOCA))+
xlab(paste("PCA 1 (",round(pca$varprop[1]*100,2),"% )",sep=""))+
ylab(paste("PCA 2 (",round(pca$varprop[2]*100,2),"% )",sep=""))+
scale_colour_manual(name="Location",
values=c(color_med_atl[2],
color_med_atl[1],
color_med_atl[3],
color_med_atl[4]))
p1<-p
p<-ggplot(data=data_pca,aes(x=PC3,y=PC4,label=INDIV))+
theme_minimal()+
theme(panel.grid=element_blank(),
panel.border=element_rect(fill="transparent"),
plot.title=element_text(hjust=0.5))+
geom_hline(yintercept=0,lty=2)+
geom_vline(xintercept=0,lty=2)+
geom_point(size=3,aes(col=LOCA))+
xlab(paste("PCA 3 (",round(pca$varprop[3]*100,2),"% )",sep=""))+
ylab(paste("PCA 4 (",round(pca$varprop[4]*100,2),"% )",sep=""))+
scale_colour_manual(name="Location",
values=c(color_med_atl[2],
color_med_atl[1],
color_med_atl[3],
color_med_atl[4]))
p2<-p
data_varpop=data.frame(PC=factor(paste("P",seq(1,10),sep=""),levels=paste("P",seq(1,10),sep="")),VAR=pca$varprop[1:10])
pp<-ggplot(data_varpop,aes(x=PC,y=VAR))+
geom_bar(stat='identity',fill="dodgerblue2",alpha=0.25)+
theme_classic()+
xlab("Principal Component")+
ylab("Variation explained (%)")
```
```{r}
subplot(ggplotly(p1)%>% layout(legend = list(orientation = "h", x = 0.2, y =-0.15)), ggplotly(p2)%>%hide_legend(), ggplotly(pp)%>%hide_legend(), titleX=T,titleY=T,margin=0.035,widths=c(0.375,0.425,0.2),which_layout=1) %>% partial_bundle()
```
### maf = 0.25
```{r}
pca=PCA_list$All_filtered$maf0.25[[1]]
data_pca=data.frame(INDIV=pca$sample.id,
PC1=pca$eigenvect[,1],
PC2=pca$eigenvect[,2],
PC3=pca$eigenvect[,3],
PC4=pca$eigenvect[,4],
LOCA=c(rep("Algarve",5),
rep("Bay of Biscay",4),
rep("Gulf of Lion",5),
rep("Costa Calida",0)))
color_med_atl=rev(brewer.pal(n=4,name="RdBu"))
p<-ggplot(data=data_pca,aes(x=PC1,y=PC2,label=INDIV))+
theme_minimal()+
theme(panel.grid=element_blank(),
panel.border=element_rect(fill="transparent"),
plot.title=element_text(hjust=0.5))+
geom_hline(yintercept=0,lty=2)+
geom_vline(xintercept=0,lty=2)+
geom_point(size=3,aes(col=LOCA))+
xlab(paste("PCA 1 (",round(pca$varprop[1]*100,2),"% )",sep=""))+
ylab(paste("PCA 2 (",round(pca$varprop[2]*100,2),"% )",sep=""))+
scale_colour_manual(name="Location",
values=c(color_med_atl[2],
color_med_atl[1],
color_med_atl[3],
color_med_atl[4]))
p1<-p
p<-ggplot(data=data_pca,aes(x=PC3,y=PC4,label=INDIV))+
theme_minimal()+
theme(panel.grid=element_blank(),
panel.border=element_rect(fill="transparent"),
plot.title=element_text(hjust=0.5))+
geom_hline(yintercept=0,lty=2)+
geom_vline(xintercept=0,lty=2)+
geom_point(size=3,aes(col=LOCA))+
xlab(paste("PCA 3 (",round(pca$varprop[3]*100,2),"% )",sep=""))+
ylab(paste("PCA 4 (",round(pca$varprop[4]*100,2),"% )",sep=""))+
scale_colour_manual(name="Location",
values=c(color_med_atl[2],
color_med_atl[1],
color_med_atl[3],
color_med_atl[4]))
p2<-p
data_varpop=data.frame(PC=factor(paste("P",seq(1,10),sep=""),levels=paste("P",seq(1,10),sep="")),VAR=pca$varprop[1:10])
pp<-ggplot(data_varpop,aes(x=PC,y=VAR))+
geom_bar(stat='identity',fill="dodgerblue2",alpha=0.25)+
theme_classic()+
xlab("Principal Component")+
ylab("Variation explained (%)")
```
```{r}
subplot(ggplotly(p1)%>% layout(legend = list(orientation = "h", x = 0.2, y =-0.15)), ggplotly(p2)%>%hide_legend(), ggplotly(pp)%>%hide_legend(), titleX=T,titleY=T,margin=0.035,widths=c(0.375,0.425,0.2),which_layout=1) %>% partial_bundle()
```
### maf = 0.30
```{r}
pca=PCA_list$All_filtered$maf0.3[[1]]
data_pca=data.frame(INDIV=pca$sample.id,
PC1=pca$eigenvect[,1],
PC2=pca$eigenvect[,2],
PC3=pca$eigenvect[,3],
PC4=pca$eigenvect[,4],
LOCA=c(rep("Algarve",5),
rep("Bay of Biscay",4),
rep("Gulf of Lion",5),
rep("Costa Calida",0)))
color_med_atl=rev(brewer.pal(n=4,name="RdBu"))
p<-ggplot(data=data_pca,aes(x=PC1,y=PC2,label=INDIV))+
theme_minimal()+
theme(panel.grid=element_blank(),
panel.border=element_rect(fill="transparent"),
plot.title=element_text(hjust=0.5))+
geom_hline(yintercept=0,lty=2)+
geom_vline(xintercept=0,lty=2)+
geom_point(size=3,aes(col=LOCA))+
xlab(paste("PCA 1 (",round(pca$varprop[1]*100,2),"% )",sep=""))+
ylab(paste("PCA 2 (",round(pca$varprop[2]*100,2),"% )",sep=""))+
scale_colour_manual(name="Location",
values=c(color_med_atl[2],
color_med_atl[1],
color_med_atl[3],
color_med_atl[4]))
p1<-p
p<-ggplot(data=data_pca,aes(x=PC3,y=PC4,label=INDIV))+
theme_minimal()+
theme(panel.grid=element_blank(),
panel.border=element_rect(fill="transparent"),
plot.title=element_text(hjust=0.5))+
geom_hline(yintercept=0,lty=2)+
geom_vline(xintercept=0,lty=2)+
geom_point(size=3,aes(col=LOCA))+
xlab(paste("PCA 3 (",round(pca$varprop[3]*100,2),"% )",sep=""))+
ylab(paste("PCA 4 (",round(pca$varprop[4]*100,2),"% )",sep=""))+
scale_colour_manual(name="Location",
values=c(color_med_atl[2],
color_med_atl[1],
color_med_atl[3],
color_med_atl[4]))
p2<-p
data_varpop=data.frame(PC=factor(paste("P",seq(1,10),sep=""),levels=paste("P",seq(1,10),sep="")),VAR=pca$varprop[1:10])
pp<-ggplot(data_varpop,aes(x=PC,y=VAR))+
geom_bar(stat='identity',fill="dodgerblue2",alpha=0.25)+
theme_classic()+
xlab("Principal Component")+
ylab("Variation explained (%)")
```
```{r}
subplot(ggplotly(p1)%>% layout(legend = list(orientation = "h", x = 0.2, y =-0.15)), ggplotly(p2)%>%hide_legend(), ggplotly(pp)%>%hide_legend(), titleX=T,titleY=T,margin=0.035,widths=c(0.375,0.425,0.2),which_layout=1) %>% partial_bundle()
```
### maf = 0.35
```{r}
pca=PCA_list$All_filtered$maf0.35[[1]]
data_pca=data.frame(INDIV=pca$sample.id,
PC1=pca$eigenvect[,1],
PC2=pca$eigenvect[,2],
PC3=pca$eigenvect[,3],
PC4=pca$eigenvect[,4],
LOCA=c(rep("Algarve",5),
rep("Bay of Biscay",4),
rep("Gulf of Lion",5),
rep("Costa Calida",0)))
color_med_atl=rev(brewer.pal(n=4,name="RdBu"))
p<-ggplot(data=data_pca,aes(x=PC1,y=PC2,label=INDIV))+
theme_minimal()+
theme(panel.grid=element_blank(),
panel.border=element_rect(fill="transparent"),
plot.title=element_text(hjust=0.5))+
geom_hline(yintercept=0,lty=2)+
geom_vline(xintercept=0,lty=2)+
geom_point(size=3,aes(col=LOCA))+
xlab(paste("PCA 1 (",round(pca$varprop[1]*100,2),"% )",sep=""))+
ylab(paste("PCA 2 (",round(pca$varprop[2]*100,2),"% )",sep=""))+
scale_colour_manual(name="Location",
values=c(color_med_atl[2],
color_med_atl[1],
color_med_atl[3],
color_med_atl[4]))
p1<-p
p<-ggplot(data=data_pca,aes(x=PC3,y=PC4,label=INDIV))+
theme_minimal()+
theme(panel.grid=element_blank(),
panel.border=element_rect(fill="transparent"),
plot.title=element_text(hjust=0.5))+
geom_hline(yintercept=0,lty=2)+
geom_vline(xintercept=0,lty=2)+
geom_point(size=3,aes(col=LOCA))+
xlab(paste("PCA 3 (",round(pca$varprop[3]*100,2),"% )",sep=""))+
ylab(paste("PCA 4 (",round(pca$varprop[4]*100,2),"% )",sep=""))+
scale_colour_manual(name="Location",
values=c(color_med_atl[2],
color_med_atl[1],
color_med_atl[3],
color_med_atl[4]))
p2<-p
data_varpop=data.frame(PC=factor(paste("P",seq(1,10),sep=""),levels=paste("P",seq(1,10),sep="")),VAR=pca$varprop[1:10])
pp<-ggplot(data_varpop,aes(x=PC,y=VAR))+
geom_bar(stat='identity',fill="dodgerblue2",alpha=0.25)+
theme_classic()+
xlab("Principal Component")+
ylab("Variation explained (%)")
```
```{r}
subplot(ggplotly(p1)%>% layout(legend = list(orientation = "h", x = 0.2, y =-0.15)), ggplotly(p2)%>%hide_legend(), ggplotly(pp)%>%hide_legend(), titleX=T,titleY=T,margin=0.035,widths=c(0.375,0.425,0.2),which_layout=1) %>% partial_bundle()
```
### maf = 0.40
```{r}
pca=PCA_list$All_filtered$maf0.4[[1]]
data_pca=data.frame(INDIV=pca$sample.id,
PC1=pca$eigenvect[,1],
PC2=pca$eigenvect[,2],
PC3=pca$eigenvect[,3],
PC4=pca$eigenvect[,4],
LOCA=c(rep("Algarve",5),
rep("Bay of Biscay",4),
rep("Gulf of Lion",5),
rep("Costa Calida",0)))
color_med_atl=rev(brewer.pal(n=4,name="RdBu"))
p<-ggplot(data=data_pca,aes(x=PC1,y=PC2,label=INDIV))+
theme_minimal()+
theme(panel.grid=element_blank(),
panel.border=element_rect(fill="transparent"),
plot.title=element_text(hjust=0.5))+
geom_hline(yintercept=0,lty=2)+
geom_vline(xintercept=0,lty=2)+
geom_point(size=3,aes(col=LOCA))+
xlab(paste("PCA 1 (",round(pca$varprop[1]*100,2),"% )",sep=""))+
ylab(paste("PCA 2 (",round(pca$varprop[2]*100,2),"% )",sep=""))+
scale_colour_manual(name="Location",
values=c(color_med_atl[2],
color_med_atl[1],
color_med_atl[3],
color_med_atl[4]))
p1<-p
p<-ggplot(data=data_pca,aes(x=PC3,y=PC4,label=INDIV))+
theme_minimal()+
theme(panel.grid=element_blank(),
panel.border=element_rect(fill="transparent"),
plot.title=element_text(hjust=0.5))+
geom_hline(yintercept=0,lty=2)+
geom_vline(xintercept=0,lty=2)+
geom_point(size=3,aes(col=LOCA))+
xlab(paste("PCA 3 (",round(pca$varprop[3]*100,2),"% )",sep=""))+
ylab(paste("PCA 4 (",round(pca$varprop[4]*100,2),"% )",sep=""))+
scale_colour_manual(name="Location",
values=c(color_med_atl[2],
color_med_atl[1],
color_med_atl[3],
color_med_atl[4]))
p2<-p
data_varpop=data.frame(PC=factor(paste("P",seq(1,10),sep=""),levels=paste("P",seq(1,10),sep="")),VAR=pca$varprop[1:10])
pp<-ggplot(data_varpop,aes(x=PC,y=VAR))+
geom_bar(stat='identity',fill="dodgerblue2",alpha=0.25)+
theme_classic()+
xlab("Principal Component")+
ylab("Variation explained (%)")
```
```{r}
subplot(ggplotly(p1)%>% layout(legend = list(orientation = "h", x = 0.2, y =-0.15)), ggplotly(p2)%>%hide_legend(), ggplotly(pp)%>%hide_legend(), titleX=T,titleY=T,margin=0.035,widths=c(0.375,0.425,0.2),which_layout=1) %>% partial_bundle()
```
### maf = 0.45
```{r}
pca=PCA_list$All_filtered$maf0.45[[1]]
data_pca=data.frame(INDIV=pca$sample.id,
PC1=pca$eigenvect[,1],
PC2=pca$eigenvect[,2],
PC3=pca$eigenvect[,3],
PC4=pca$eigenvect[,4],
LOCA=c(rep("Algarve",5),
rep("Bay of Biscay",4),
rep("Gulf of Lion",5),
rep("Costa Calida",0)))
color_med_atl=rev(brewer.pal(n=4,name="RdBu"))
p<-ggplot(data=data_pca,aes(x=PC1,y=PC2,label=INDIV))+
theme_minimal()+
theme(panel.grid=element_blank(),
panel.border=element_rect(fill="transparent"),
plot.title=element_text(hjust=0.5))+
geom_hline(yintercept=0,lty=2)+
geom_vline(xintercept=0,lty=2)+
geom_point(size=3,aes(col=LOCA))+
xlab(paste("PCA 1 (",round(pca$varprop[1]*100,2),"% )",sep=""))+
ylab(paste("PCA 2 (",round(pca$varprop[2]*100,2),"% )",sep=""))+
scale_colour_manual(name="Location",
values=c(color_med_atl[2],
color_med_atl[1],
color_med_atl[3],
color_med_atl[4]))
p1<-p
p<-ggplot(data=data_pca,aes(x=PC3,y=PC4,label=INDIV))+
theme_minimal()+
theme(panel.grid=element_blank(),
panel.border=element_rect(fill="transparent"),
plot.title=element_text(hjust=0.5))+
geom_hline(yintercept=0,lty=2)+
geom_vline(xintercept=0,lty=2)+
geom_point(size=3,aes(col=LOCA))+
xlab(paste("PCA 3 (",round(pca$varprop[3]*100,2),"% )",sep=""))+
ylab(paste("PCA 4 (",round(pca$varprop[4]*100,2),"% )",sep=""))+
scale_colour_manual(name="Location",
values=c(color_med_atl[2],
color_med_atl[1],
color_med_atl[3],
color_med_atl[4]))
p2<-p
data_varpop=data.frame(PC=factor(paste("P",seq(1,10),sep=""),levels=paste("P",seq(1,10),sep="")),VAR=pca$varprop[1:10])
pp<-ggplot(data_varpop,aes(x=PC,y=VAR))+
geom_bar(stat='identity',fill="dodgerblue2",alpha=0.25)+
theme_classic()+
xlab("Principal Component")+
ylab("Variation explained (%)")
```
```{r}
subplot(ggplotly(p1)%>% layout(legend = list(orientation = "h", x = 0.2, y =-0.15)), ggplotly(p2)%>%hide_legend(), ggplotly(pp)%>%hide_legend(), titleX=T,titleY=T,margin=0.035,widths=c(0.375,0.425,0.2),which_layout=1) %>% partial_bundle()
```
### maf = 0.50
```{r}
pca=PCA_list$All_filtered$maf0.5[[1]]
data_pca=data.frame(INDIV=pca$sample.id,
PC1=pca$eigenvect[,1],
PC2=pca$eigenvect[,2],
PC3=pca$eigenvect[,3],
PC4=pca$eigenvect[,4],
LOCA=c(rep("Algarve",5),
rep("Bay of Biscay",4),
rep("Gulf of Lion",5),
rep("Costa Calida",0)))
color_med_atl=rev(brewer.pal(n=4,name="RdBu"))
p<-ggplot(data=data_pca,aes(x=PC1,y=PC2,label=INDIV))+
theme_minimal()+
theme(panel.grid=element_blank(),
panel.border=element_rect(fill="transparent"),
plot.title=element_text(hjust=0.5))+
geom_hline(yintercept=0,lty=2)+
geom_vline(xintercept=0,lty=2)+
geom_point(size=3,aes(col=LOCA))+
xlab(paste("PCA 1 (",round(pca$varprop[1]*100,2),"% )",sep=""))+
ylab(paste("PCA 2 (",round(pca$varprop[2]*100,2),"% )",sep=""))+
scale_colour_manual(name="Location",
values=c(color_med_atl[2],
color_med_atl[1],
color_med_atl[3],
color_med_atl[4]))
p1<-p
p<-ggplot(data=data_pca,aes(x=PC3,y=PC4,label=INDIV))+
theme_minimal()+
theme(panel.grid=element_blank(),
panel.border=element_rect(fill="transparent"),
plot.title=element_text(hjust=0.5))+
geom_hline(yintercept=0,lty=2)+
geom_vline(xintercept=0,lty=2)+
geom_point(size=3,aes(col=LOCA))+
xlab(paste("PCA 3 (",round(pca$varprop[3]*100,2),"% )",sep=""))+
ylab(paste("PCA 4 (",round(pca$varprop[4]*100,2),"% )",sep=""))+
scale_colour_manual(name="Location",
values=c(color_med_atl[2],
color_med_atl[1],
color_med_atl[3],
color_med_atl[4]))
p2<-p
data_varpop=data.frame(PC=factor(paste("P",seq(1,10),sep=""),levels=paste("P",seq(1,10),sep="")),VAR=pca$varprop[1:10])
pp<-ggplot(data_varpop,aes(x=PC,y=VAR))+
geom_bar(stat='identity',fill="dodgerblue2",alpha=0.25)+
theme_classic()+
xlab("Principal Component")+
ylab("Variation explained (%)")
```
```{r}
subplot(ggplotly(p1)%>% layout(legend = list(orientation = "h", x = 0.2, y =-0.15)), ggplotly(p2)%>%hide_legend(), ggplotly(pp)%>%hide_legend(), titleX=T,titleY=T,margin=0.035,widths=c(0.375,0.425,0.2),which_layout=1) %>% partial_bundle()
```
Row {.tabset data-height=50}
-----------------------
<center>
<font size="6">**Pruned filtered SNPS**</font>
</center>
Row {.tabset data-height=600}
-----------------------
### maf = 0
```{r}
pca=PCA_list$Prune_filtered$maf0[[1]]
data_pca=data.frame(INDIV=pca$sample.id,
PC1=pca$eigenvect[,1],
PC2=pca$eigenvect[,2],
PC3=pca$eigenvect[,3],
PC4=pca$eigenvect[,4],
LOCA=c(rep("Algarve",5),
rep("Bay of Biscay",4),
rep("Gulf of Lion",5),
rep("Costa Calida",0)))
color_med_atl=rev(brewer.pal(n=4,name="RdBu"))
p<-ggplot(data=data_pca,aes(x=PC1,y=PC2,label=INDIV))+
theme_minimal()+
theme(panel.grid=element_blank(),
panel.border=element_rect(fill="transparent"),
plot.title=element_text(hjust=0.5))+
geom_hline(yintercept=0,lty=2)+
geom_vline(xintercept=0,lty=2)+
geom_point(size=3,aes(col=LOCA))+
xlab(paste("PCA 1 (",round(pca$varprop[1]*100,2),"% )",sep=""))+
ylab(paste("PCA 2 (",round(pca$varprop[2]*100,2),"% )",sep=""))+
scale_colour_manual(name="Location",
values=c(color_med_atl[2],
color_med_atl[1],
color_med_atl[3],
color_med_atl[4]))
p1<-p
p<-ggplot(data=data_pca,aes(x=PC3,y=PC4,label=INDIV))+
theme_minimal()+
theme(panel.grid=element_blank(),
panel.border=element_rect(fill="transparent"),
plot.title=element_text(hjust=0.5))+
geom_hline(yintercept=0,lty=2)+
geom_vline(xintercept=0,lty=2)+
geom_point(size=3,aes(col=LOCA))+
xlab(paste("PCA 3 (",round(pca$varprop[3]*100,2),"% )",sep=""))+
ylab(paste("PCA 4 (",round(pca$varprop[4]*100,2),"% )",sep=""))+
scale_colour_manual(name="Location",
values=c(color_med_atl[2],
color_med_atl[1],
color_med_atl[3],
color_med_atl[4]))
p2<-p
data_varpop=data.frame(PC=factor(paste("P",seq(1,10),sep=""),levels=paste("P",seq(1,10),sep="")),VAR=pca$varprop[1:10])
pp<-ggplot(data_varpop,aes(x=PC,y=VAR))+
geom_bar(stat='identity',fill="dodgerblue2",alpha=0.25)+
theme_classic()+
xlab("Principal Component")+
ylab("Variation explained (%)")
```
```{r}
subplot(ggplotly(p1)%>% layout(legend = list(orientation = "h", x = 0.2, y =-0.15)), ggplotly(p2)%>%hide_legend(), ggplotly(pp)%>%hide_legend(), titleX=T,titleY=T,margin=0.035,widths=c(0.375,0.425,0.2),which_layout=1) %>% partial_bundle()
```
### maf = 0.05
```{r}
pca=PCA_list$Prune_filtered$maf0.05[[1]]
data_pca=data.frame(INDIV=pca$sample.id,
PC1=pca$eigenvect[,1],
PC2=pca$eigenvect[,2],
PC3=pca$eigenvect[,3],
PC4=pca$eigenvect[,4],
LOCA=c(rep("Algarve",5),
rep("Bay of Biscay",4),
rep("Gulf of Lion",5),
rep("Costa Calida",0)))
color_med_atl=rev(brewer.pal(n=4,name="RdBu"))
p<-ggplot(data=data_pca,aes(x=PC1,y=PC2,label=INDIV))+
theme_minimal()+
theme(panel.grid=element_blank(),
panel.border=element_rect(fill="transparent"),
plot.title=element_text(hjust=0.5))+
geom_hline(yintercept=0,lty=2)+
geom_vline(xintercept=0,lty=2)+
geom_point(size=3,aes(col=LOCA))+
xlab(paste("PCA 1 (",round(pca$varprop[1]*100,2),"% )",sep=""))+
ylab(paste("PCA 2 (",round(pca$varprop[2]*100,2),"% )",sep=""))+
scale_colour_manual(name="Location",
values=c(color_med_atl[2],
color_med_atl[1],
color_med_atl[3],
color_med_atl[4]))
p1<-p
p<-ggplot(data=data_pca,aes(x=PC3,y=PC4,label=INDIV))+
theme_minimal()+
theme(panel.grid=element_blank(),
panel.border=element_rect(fill="transparent"),
plot.title=element_text(hjust=0.5))+
geom_hline(yintercept=0,lty=2)+
geom_vline(xintercept=0,lty=2)+
geom_point(size=3,aes(col=LOCA))+
xlab(paste("PCA 3 (",round(pca$varprop[3]*100,2),"% )",sep=""))+
ylab(paste("PCA 4 (",round(pca$varprop[4]*100,2),"% )",sep=""))+
scale_colour_manual(name="Location",
values=c(color_med_atl[2],
color_med_atl[1],
color_med_atl[3],
color_med_atl[4]))
p2<-p
data_varpop=data.frame(PC=factor(paste("P",seq(1,10),sep=""),levels=paste("P",seq(1,10),sep="")),VAR=pca$varprop[1:10])
pp<-ggplot(data_varpop,aes(x=PC,y=VAR))+
geom_bar(stat='identity',fill="dodgerblue2",alpha=0.25)+
theme_classic()+
xlab("Principal Component")+
ylab("Variation explained (%)")
```
```{r}
subplot(ggplotly(p1)%>% layout(legend = list(orientation = "h", x = 0.2, y =-0.15)), ggplotly(p2)%>%hide_legend(), ggplotly(pp)%>%hide_legend(), titleX=T,titleY=T,margin=0.035,widths=c(0.375,0.425,0.2),which_layout=1) %>% partial_bundle()
```
### maf = 0.1
```{r}
pca=PCA_list$Prune_filtered$maf0.1[[1]]
data_pca=data.frame(INDIV=pca$sample.id,
PC1=pca$eigenvect[,1],
PC2=pca$eigenvect[,2],
PC3=pca$eigenvect[,3],
PC4=pca$eigenvect[,4],
LOCA=c(rep("Algarve",5),
rep("Bay of Biscay",4),
rep("Gulf of Lion",5),
rep("Costa Calida",0)))
color_med_atl=rev(brewer.pal(n=4,name="RdBu"))
p<-ggplot(data=data_pca,aes(x=PC1,y=PC2,label=INDIV))+
theme_minimal()+
theme(panel.grid=element_blank(),
panel.border=element_rect(fill="transparent"),
plot.title=element_text(hjust=0.5))+
geom_hline(yintercept=0,lty=2)+
geom_vline(xintercept=0,lty=2)+
geom_point(size=3,aes(col=LOCA))+
xlab(paste("PCA 1 (",round(pca$varprop[1]*100,2),"% )",sep=""))+
ylab(paste("PCA 2 (",round(pca$varprop[2]*100,2),"% )",sep=""))+
scale_colour_manual(name="Location",
values=c(color_med_atl[2],
color_med_atl[1],
color_med_atl[3],
color_med_atl[4]))
p1<-p
p<-ggplot(data=data_pca,aes(x=PC3,y=PC4,label=INDIV))+
theme_minimal()+
theme(panel.grid=element_blank(),
panel.border=element_rect(fill="transparent"),
plot.title=element_text(hjust=0.5))+
geom_hline(yintercept=0,lty=2)+
geom_vline(xintercept=0,lty=2)+
geom_point(size=3,aes(col=LOCA))+
xlab(paste("PCA 3 (",round(pca$varprop[3]*100,2),"% )",sep=""))+
ylab(paste("PCA 4 (",round(pca$varprop[4]*100,2),"% )",sep=""))+
scale_colour_manual(name="Location",
values=c(color_med_atl[2],
color_med_atl[1],
color_med_atl[3],
color_med_atl[4]))
p2<-p
data_varpop=data.frame(PC=factor(paste("P",seq(1,10),sep=""),levels=paste("P",seq(1,10),sep="")),VAR=pca$varprop[1:10])
pp<-ggplot(data_varpop,aes(x=PC,y=VAR))+
geom_bar(stat='identity',fill="dodgerblue2",alpha=0.25)+
theme_classic()+
xlab("Principal Component")+
ylab("Variation explained (%)")
```
```{r}
subplot(ggplotly(p1)%>% layout(legend = list(orientation = "h", x = 0.2, y =-0.15)), ggplotly(p2)%>%hide_legend(), ggplotly(pp)%>%hide_legend(), titleX=T,titleY=T,margin=0.035,widths=c(0.375,0.425,0.2),which_layout=1) %>% partial_bundle()
```
### maf = 0.15
```{r}
pca=PCA_list$Prune_filtered$maf0.15[[1]]
data_pca=data.frame(INDIV=pca$sample.id,
PC1=pca$eigenvect[,1],
PC2=pca$eigenvect[,2],
PC3=pca$eigenvect[,3],
PC4=pca$eigenvect[,4],
LOCA=c(rep("Algarve",5),
rep("Bay of Biscay",4),
rep("Gulf of Lion",5),
rep("Costa Calida",0)))
color_med_atl=rev(brewer.pal(n=4,name="RdBu"))
p<-ggplot(data=data_pca,aes(x=PC1,y=PC2,label=INDIV))+
theme_minimal()+
theme(panel.grid=element_blank(),
panel.border=element_rect(fill="transparent"),
plot.title=element_text(hjust=0.5))+
geom_hline(yintercept=0,lty=2)+
geom_vline(xintercept=0,lty=2)+
geom_point(size=3,aes(col=LOCA))+
xlab(paste("PCA 1 (",round(pca$varprop[1]*100,2),"% )",sep=""))+
ylab(paste("PCA 2 (",round(pca$varprop[2]*100,2),"% )",sep=""))+
scale_colour_manual(name="Location",
values=c(color_med_atl[2],
color_med_atl[1],
color_med_atl[3],
color_med_atl[4]))
p1<-p
p<-ggplot(data=data_pca,aes(x=PC3,y=PC4,label=INDIV))+
theme_minimal()+
theme(panel.grid=element_blank(),
panel.border=element_rect(fill="transparent"),
plot.title=element_text(hjust=0.5))+
geom_hline(yintercept=0,lty=2)+
geom_vline(xintercept=0,lty=2)+
geom_point(size=3,aes(col=LOCA))+
xlab(paste("PCA 3 (",round(pca$varprop[3]*100,2),"% )",sep=""))+
ylab(paste("PCA 4 (",round(pca$varprop[4]*100,2),"% )",sep=""))+
scale_colour_manual(name="Location",
values=c(color_med_atl[2],
color_med_atl[1],
color_med_atl[3],
color_med_atl[4]))
p2<-p
data_varpop=data.frame(PC=factor(paste("P",seq(1,10),sep=""),levels=paste("P",seq(1,10),sep="")),VAR=pca$varprop[1:10])
pp<-ggplot(data_varpop,aes(x=PC,y=VAR))+
geom_bar(stat='identity',fill="dodgerblue2",alpha=0.25)+
theme_classic()+
xlab("Principal Component")+
ylab("Variation explained (%)")
```
```{r}
subplot(ggplotly(p1)%>% layout(legend = list(orientation = "h", x = 0.2, y =-0.15)), ggplotly(p2)%>%hide_legend(), ggplotly(pp)%>%hide_legend(), titleX=T,titleY=T,margin=0.035,widths=c(0.375,0.425,0.2),which_layout=1) %>% partial_bundle()
```
### maf = 0.20
```{r}
pca=PCA_list$Prune_filtered$maf0.2[[1]]
data_pca=data.frame(INDIV=pca$sample.id,
PC1=pca$eigenvect[,1],
PC2=pca$eigenvect[,2],
PC3=pca$eigenvect[,3],
PC4=pca$eigenvect[,4],
LOCA=c(rep("Algarve",5),
rep("Bay of Biscay",4),
rep("Gulf of Lion",5),
rep("Costa Calida",0)))
color_med_atl=rev(brewer.pal(n=4,name="RdBu"))
p<-ggplot(data=data_pca,aes(x=PC1,y=PC2,label=INDIV))+
theme_minimal()+
theme(panel.grid=element_blank(),
panel.border=element_rect(fill="transparent"),
plot.title=element_text(hjust=0.5))+
geom_hline(yintercept=0,lty=2)+
geom_vline(xintercept=0,lty=2)+
geom_point(size=3,aes(col=LOCA))+
xlab(paste("PCA 1 (",round(pca$varprop[1]*100,2),"% )",sep=""))+
ylab(paste("PCA 2 (",round(pca$varprop[2]*100,2),"% )",sep=""))+
scale_colour_manual(name="Location",
values=c(color_med_atl[2],
color_med_atl[1],
color_med_atl[3],
color_med_atl[4]))
p1<-p
p<-ggplot(data=data_pca,aes(x=PC3,y=PC4,label=INDIV))+
theme_minimal()+
theme(panel.grid=element_blank(),
panel.border=element_rect(fill="transparent"),
plot.title=element_text(hjust=0.5))+
geom_hline(yintercept=0,lty=2)+
geom_vline(xintercept=0,lty=2)+
geom_point(size=3,aes(col=LOCA))+
xlab(paste("PCA 3 (",round(pca$varprop[3]*100,2),"% )",sep=""))+
ylab(paste("PCA 4 (",round(pca$varprop[4]*100,2),"% )",sep=""))+
scale_colour_manual(name="Location",
values=c(color_med_atl[2],
color_med_atl[1],
color_med_atl[3],
color_med_atl[4]))
p2<-p
data_varpop=data.frame(PC=factor(paste("P",seq(1,10),sep=""),levels=paste("P",seq(1,10),sep="")),VAR=pca$varprop[1:10])
pp<-ggplot(data_varpop,aes(x=PC,y=VAR))+
geom_bar(stat='identity',fill="dodgerblue2",alpha=0.25)+
theme_classic()+
xlab("Principal Component")+
ylab("Variation explained (%)")
```
```{r}
subplot(ggplotly(p1)%>% layout(legend = list(orientation = "h", x = 0.2, y =-0.15)), ggplotly(p2)%>%hide_legend(), ggplotly(pp)%>%hide_legend(), titleX=T,titleY=T,margin=0.035,widths=c(0.375,0.425,0.2),which_layout=1) %>% partial_bundle()
```
### maf = 0.25
```{r}
pca=PCA_list$Prune_filtered$maf0.25[[1]]
data_pca=data.frame(INDIV=pca$sample.id,
PC1=pca$eigenvect[,1],
PC2=pca$eigenvect[,2],
PC3=pca$eigenvect[,3],
PC4=pca$eigenvect[,4],
LOCA=c(rep("Algarve",5),
rep("Bay of Biscay",4),
rep("Gulf of Lion",5),
rep("Costa Calida",0)))
color_med_atl=rev(brewer.pal(n=4,name="RdBu"))
p<-ggplot(data=data_pca,aes(x=PC1,y=PC2,label=INDIV))+
theme_minimal()+
theme(panel.grid=element_blank(),
panel.border=element_rect(fill="transparent"),
plot.title=element_text(hjust=0.5))+
geom_hline(yintercept=0,lty=2)+
geom_vline(xintercept=0,lty=2)+
geom_point(size=3,aes(col=LOCA))+
xlab(paste("PCA 1 (",round(pca$varprop[1]*100,2),"% )",sep=""))+
ylab(paste("PCA 2 (",round(pca$varprop[2]*100,2),"% )",sep=""))+
scale_colour_manual(name="Location",
values=c(color_med_atl[2],
color_med_atl[1],
color_med_atl[3],
color_med_atl[4]))
p1<-p
p<-ggplot(data=data_pca,aes(x=PC3,y=PC4,label=INDIV))+
theme_minimal()+
theme(panel.grid=element_blank(),
panel.border=element_rect(fill="transparent"),
plot.title=element_text(hjust=0.5))+
geom_hline(yintercept=0,lty=2)+
geom_vline(xintercept=0,lty=2)+
geom_point(size=3,aes(col=LOCA))+
xlab(paste("PCA 3 (",round(pca$varprop[3]*100,2),"% )",sep=""))+
ylab(paste("PCA 4 (",round(pca$varprop[4]*100,2),"% )",sep=""))+
scale_colour_manual(name="Location",
values=c(color_med_atl[2],
color_med_atl[1],
color_med_atl[3],
color_med_atl[4]))
p2<-p
data_varpop=data.frame(PC=factor(paste("P",seq(1,10),sep=""),levels=paste("P",seq(1,10),sep="")),VAR=pca$varprop[1:10])
pp<-ggplot(data_varpop,aes(x=PC,y=VAR))+
geom_bar(stat='identity',fill="dodgerblue2",alpha=0.25)+
theme_classic()+
xlab("Principal Component")+
ylab("Variation explained (%)")
```
```{r}
subplot(ggplotly(p1)%>% layout(legend = list(orientation = "h", x = 0.2, y =-0.15)), ggplotly(p2)%>%hide_legend(), ggplotly(pp)%>%hide_legend(), titleX=T,titleY=T,margin=0.035,widths=c(0.375,0.425,0.2),which_layout=1) %>% partial_bundle()
```
### maf = 0.30
```{r}
pca=PCA_list$Prune_filtered$maf0.3[[1]]
data_pca=data.frame(INDIV=pca$sample.id,
PC1=pca$eigenvect[,1],
PC2=pca$eigenvect[,2],
PC3=pca$eigenvect[,3],
PC4=pca$eigenvect[,4],
LOCA=c(rep("Algarve",5),
rep("Bay of Biscay",4),
rep("Gulf of Lion",5),
rep("Costa Calida",0)))
color_med_atl=rev(brewer.pal(n=4,name="RdBu"))
p<-ggplot(data=data_pca,aes(x=PC1,y=PC2,label=INDIV))+
theme_minimal()+
theme(panel.grid=element_blank(),
panel.border=element_rect(fill="transparent"),
plot.title=element_text(hjust=0.5))+
geom_hline(yintercept=0,lty=2)+
geom_vline(xintercept=0,lty=2)+
geom_point(size=3,aes(col=LOCA))+
xlab(paste("PCA 1 (",round(pca$varprop[1]*100,2),"% )",sep=""))+
ylab(paste("PCA 2 (",round(pca$varprop[2]*100,2),"% )",sep=""))+
scale_colour_manual(name="Location",
values=c(color_med_atl[2],
color_med_atl[1],
color_med_atl[3],
color_med_atl[4]))
p1<-p
p<-ggplot(data=data_pca,aes(x=PC3,y=PC4,label=INDIV))+
theme_minimal()+
theme(panel.grid=element_blank(),
panel.border=element_rect(fill="transparent"),
plot.title=element_text(hjust=0.5))+
geom_hline(yintercept=0,lty=2)+
geom_vline(xintercept=0,lty=2)+
geom_point(size=3,aes(col=LOCA))+
xlab(paste("PCA 3 (",round(pca$varprop[3]*100,2),"% )",sep=""))+
ylab(paste("PCA 4 (",round(pca$varprop[4]*100,2),"% )",sep=""))+
scale_colour_manual(name="Location",
values=c(color_med_atl[2],
color_med_atl[1],
color_med_atl[3],
color_med_atl[4]))
p2<-p
data_varpop=data.frame(PC=factor(paste("P",seq(1,10),sep=""),levels=paste("P",seq(1,10),sep="")),VAR=pca$varprop[1:10])
pp<-ggplot(data_varpop,aes(x=PC,y=VAR))+
geom_bar(stat='identity',fill="dodgerblue2",alpha=0.25)+
theme_classic()+
xlab("Principal Component")+
ylab("Variation explained (%)")
```
```{r}
subplot(ggplotly(p1)%>% layout(legend = list(orientation = "h", x = 0.2, y =-0.15)), ggplotly(p2)%>%hide_legend(), ggplotly(pp)%>%hide_legend(), titleX=T,titleY=T,margin=0.035,widths=c(0.375,0.425,0.2),which_layout=1) %>% partial_bundle()
```
### maf = 0.35
```{r}
pca=PCA_list$Prune_filtered$maf0.35[[1]]
data_pca=data.frame(INDIV=pca$sample.id,
PC1=pca$eigenvect[,1],
PC2=pca$eigenvect[,2],
PC3=pca$eigenvect[,3],
PC4=pca$eigenvect[,4],
LOCA=c(rep("Algarve",5),
rep("Bay of Biscay",4),
rep("Gulf of Lion",5),
rep("Costa Calida",0)))
color_med_atl=rev(brewer.pal(n=4,name="RdBu"))
p<-ggplot(data=data_pca,aes(x=PC1,y=PC2,label=INDIV))+
theme_minimal()+
theme(panel.grid=element_blank(),
panel.border=element_rect(fill="transparent"),
plot.title=element_text(hjust=0.5))+
geom_hline(yintercept=0,lty=2)+
geom_vline(xintercept=0,lty=2)+
geom_point(size=3,aes(col=LOCA))+
xlab(paste("PCA 1 (",round(pca$varprop[1]*100,2),"% )",sep=""))+
ylab(paste("PCA 2 (",round(pca$varprop[2]*100,2),"% )",sep=""))+
scale_colour_manual(name="Location",
values=c(color_med_atl[2],
color_med_atl[1],
color_med_atl[3],
color_med_atl[4]))
p1<-p
p<-ggplot(data=data_pca,aes(x=PC3,y=PC4,label=INDIV))+
theme_minimal()+
theme(panel.grid=element_blank(),
panel.border=element_rect(fill="transparent"),
plot.title=element_text(hjust=0.5))+
geom_hline(yintercept=0,lty=2)+
geom_vline(xintercept=0,lty=2)+
geom_point(size=3,aes(col=LOCA))+
xlab(paste("PCA 3 (",round(pca$varprop[3]*100,2),"% )",sep=""))+
ylab(paste("PCA 4 (",round(pca$varprop[4]*100,2),"% )",sep=""))+
scale_colour_manual(name="Location",
values=c(color_med_atl[2],
color_med_atl[1],
color_med_atl[3],
color_med_atl[4]))
p2<-p
data_varpop=data.frame(PC=factor(paste("P",seq(1,10),sep=""),levels=paste("P",seq(1,10),sep="")),VAR=pca$varprop[1:10])
pp<-ggplot(data_varpop,aes(x=PC,y=VAR))+
geom_bar(stat='identity',fill="dodgerblue2",alpha=0.25)+
theme_classic()+
xlab("Principal Component")+
ylab("Variation explained (%)")
```
```{r}
subplot(ggplotly(p1)%>% layout(legend = list(orientation = "h", x = 0.2, y =-0.15)), ggplotly(p2)%>%hide_legend(), ggplotly(pp)%>%hide_legend(), titleX=T,titleY=T,margin=0.035,widths=c(0.375,0.425,0.2),which_layout=1) %>% partial_bundle()
```
### maf = 0.40
```{r}
pca=PCA_list$Prune_filtered$maf0.4[[1]]
data_pca=data.frame(INDIV=pca$sample.id,
PC1=pca$eigenvect[,1],
PC2=pca$eigenvect[,2],
PC3=pca$eigenvect[,3],
PC4=pca$eigenvect[,4],
LOCA=c(rep("Algarve",5),
rep("Bay of Biscay",4),
rep("Gulf of Lion",5),
rep("Costa Calida",0)))
color_med_atl=rev(brewer.pal(n=4,name="RdBu"))
p<-ggplot(data=data_pca,aes(x=PC1,y=PC2,label=INDIV))+
theme_minimal()+
theme(panel.grid=element_blank(),
panel.border=element_rect(fill="transparent"),
plot.title=element_text(hjust=0.5))+
geom_hline(yintercept=0,lty=2)+
geom_vline(xintercept=0,lty=2)+
geom_point(size=3,aes(col=LOCA))+
xlab(paste("PCA 1 (",round(pca$varprop[1]*100,2),"% )",sep=""))+
ylab(paste("PCA 2 (",round(pca$varprop[2]*100,2),"% )",sep=""))+
scale_colour_manual(name="Location",
values=c(color_med_atl[2],
color_med_atl[1],
color_med_atl[3],
color_med_atl[4]))
p1<-p
p<-ggplot(data=data_pca,aes(x=PC3,y=PC4,label=INDIV))+
theme_minimal()+
theme(panel.grid=element_blank(),
panel.border=element_rect(fill="transparent"),
plot.title=element_text(hjust=0.5))+
geom_hline(yintercept=0,lty=2)+
geom_vline(xintercept=0,lty=2)+
geom_point(size=3,aes(col=LOCA))+
xlab(paste("PCA 3 (",round(pca$varprop[3]*100,2),"% )",sep=""))+
ylab(paste("PCA 4 (",round(pca$varprop[4]*100,2),"% )",sep=""))+
scale_colour_manual(name="Location",
values=c(color_med_atl[2],
color_med_atl[1],
color_med_atl[3],
color_med_atl[4]))
p2<-p
data_varpop=data.frame(PC=factor(paste("P",seq(1,10),sep=""),levels=paste("P",seq(1,10),sep="")),VAR=pca$varprop[1:10])
pp<-ggplot(data_varpop,aes(x=PC,y=VAR))+
geom_bar(stat='identity',fill="dodgerblue2",alpha=0.25)+
theme_classic()+
xlab("Principal Component")+
ylab("Variation explained (%)")
```
```{r}
subplot(ggplotly(p1)%>% layout(legend = list(orientation = "h", x = 0.2, y =-0.15)), ggplotly(p2)%>%hide_legend(), ggplotly(pp)%>%hide_legend(), titleX=T,titleY=T,margin=0.035,widths=c(0.375,0.425,0.2),which_layout=1) %>% partial_bundle()
```
### maf = 0.45
```{r}
pca=PCA_list$Prune_filtered$maf0.45[[1]]
data_pca=data.frame(INDIV=pca$sample.id,
PC1=pca$eigenvect[,1],
PC2=pca$eigenvect[,2],
PC3=pca$eigenvect[,3],
PC4=pca$eigenvect[,4],
LOCA=c(rep("Algarve",5),
rep("Bay of Biscay",4),
rep("Gulf of Lion",5),
rep("Costa Calida",0)))
color_med_atl=rev(brewer.pal(n=4,name="RdBu"))
p<-ggplot(data=data_pca,aes(x=PC1,y=PC2,label=INDIV))+
theme_minimal()+
theme(panel.grid=element_blank(),
panel.border=element_rect(fill="transparent"),
plot.title=element_text(hjust=0.5))+
geom_hline(yintercept=0,lty=2)+
geom_vline(xintercept=0,lty=2)+
geom_point(size=3,aes(col=LOCA))+
xlab(paste("PCA 1 (",round(pca$varprop[1]*100,2),"% )",sep=""))+
ylab(paste("PCA 2 (",round(pca$varprop[2]*100,2),"% )",sep=""))+
scale_colour_manual(name="Location",
values=c(color_med_atl[2],
color_med_atl[1],
color_med_atl[3],
color_med_atl[4]))
p1<-p
p<-ggplot(data=data_pca,aes(x=PC3,y=PC4,label=INDIV))+
theme_minimal()+
theme(panel.grid=element_blank(),
panel.border=element_rect(fill="transparent"),
plot.title=element_text(hjust=0.5))+
geom_hline(yintercept=0,lty=2)+
geom_vline(xintercept=0,lty=2)+
geom_point(size=3,aes(col=LOCA))+
xlab(paste("PCA 3 (",round(pca$varprop[3]*100,2),"% )",sep=""))+
ylab(paste("PCA 4 (",round(pca$varprop[4]*100,2),"% )",sep=""))+
scale_colour_manual(name="Location",
values=c(color_med_atl[2],
color_med_atl[1],
color_med_atl[3],
color_med_atl[4]))
p2<-p
data_varpop=data.frame(PC=factor(paste("P",seq(1,10),sep=""),levels=paste("P",seq(1,10),sep="")),VAR=pca$varprop[1:10])
pp<-ggplot(data_varpop,aes(x=PC,y=VAR))+
geom_bar(stat='identity',fill="dodgerblue2",alpha=0.25)+
theme_classic()+
xlab("Principal Component")+
ylab("Variation explained (%)")
```
```{r}
subplot(ggplotly(p1)%>% layout(legend = list(orientation = "h", x = 0.2, y =-0.15)), ggplotly(p2)%>%hide_legend(), ggplotly(pp)%>%hide_legend(), titleX=T,titleY=T,margin=0.035,widths=c(0.375,0.425,0.2),which_layout=1) %>% partial_bundle()
```
### maf = 0.50
```{r}
pca=PCA_list$Prune_filtered$maf0.5[[1]]
data_pca=data.frame(INDIV=pca$sample.id,
PC1=pca$eigenvect[,1],
PC2=pca$eigenvect[,2],
PC3=pca$eigenvect[,3],
PC4=pca$eigenvect[,4],
LOCA=c(rep("Algarve",5),
rep("Bay of Biscay",4),
rep("Gulf of Lion",5),
rep("Costa Calida",0)))
color_med_atl=rev(brewer.pal(n=4,name="RdBu"))
p<-ggplot(data=data_pca,aes(x=PC1,y=PC2,label=INDIV))+
theme_minimal()+
theme(panel.grid=element_blank(),
panel.border=element_rect(fill="transparent"),
plot.title=element_text(hjust=0.5))+
geom_hline(yintercept=0,lty=2)+
geom_vline(xintercept=0,lty=2)+
geom_point(size=3,aes(col=LOCA))+
xlab(paste("PCA 1 (",round(pca$varprop[1]*100,2),"% )",sep=""))+
ylab(paste("PCA 2 (",round(pca$varprop[2]*100,2),"% )",sep=""))+
scale_colour_manual(name="Location",
values=c(color_med_atl[2],
color_med_atl[1],
color_med_atl[3],
color_med_atl[4]))
p1<-p
p<-ggplot(data=data_pca,aes(x=PC3,y=PC4,label=INDIV))+
theme_minimal()+
theme(panel.grid=element_blank(),
panel.border=element_rect(fill="transparent"),
plot.title=element_text(hjust=0.5))+
geom_hline(yintercept=0,lty=2)+
geom_vline(xintercept=0,lty=2)+
geom_point(size=3,aes(col=LOCA))+
xlab(paste("PCA 3 (",round(pca$varprop[3]*100,2),"% )",sep=""))+
ylab(paste("PCA 4 (",round(pca$varprop[4]*100,2),"% )",sep=""))+
scale_colour_manual(name="Location",
values=c(color_med_atl[2],
color_med_atl[1],
color_med_atl[3],
color_med_atl[4]))
p2<-p
data_varpop=data.frame(PC=factor(paste("P",seq(1,10),sep=""),levels=paste("P",seq(1,10),sep="")),VAR=pca$varprop[1:10])
pp<-ggplot(data_varpop,aes(x=PC,y=VAR))+
geom_bar(stat='identity',fill="dodgerblue2",alpha=0.25)+
theme_classic()+
xlab("Principal Component")+
ylab("Variation explained (%)")
```
```{r}
subplot(ggplotly(p1)%>% layout(legend = list(orientation = "h", x = 0.2, y =-0.15)), ggplotly(p2)%>%hide_legend(), ggplotly(pp)%>%hide_legend(), titleX=T,titleY=T,margin=0.035,widths=c(0.375,0.425,0.2),which_layout=1) %>% partial_bundle()
```
Row {.tabset data-height=50}
-----------------------
<center>
<font size="6">**All unfiltered SNPS**</font>
</center>
Row {.tabset data-height=600}
-----------------------
### maf = 0
```{r}
pca=PCA_list$All_unfiltered$maf0[[1]]
data_pca=data.frame(INDIV=pca$sample.id,
PC1=pca$eigenvect[,1],
PC2=pca$eigenvect[,2],
PC3=pca$eigenvect[,3],
PC4=pca$eigenvect[,4],
LOCA=c(rep("Algarve",5),
rep("Bay of Biscay",4),
rep("Gulf of Lion",5),
rep("Costa Calida",0)))
color_med_atl=rev(brewer.pal(n=4,name="RdBu"))
p<-ggplot(data=data_pca,aes(x=PC1,y=PC2,label=INDIV))+
theme_minimal()+
theme(panel.grid=element_blank(),
panel.border=element_rect(fill="transparent"),
plot.title=element_text(hjust=0.5))+
geom_hline(yintercept=0,lty=2)+
geom_vline(xintercept=0,lty=2)+
geom_point(size=3,aes(col=LOCA))+
xlab(paste("PCA 1 (",round(pca$varprop[1]*100,2),"% )",sep=""))+
ylab(paste("PCA 2 (",round(pca$varprop[2]*100,2),"% )",sep=""))+
scale_colour_manual(name="Location",
values=c(color_med_atl[2],
color_med_atl[1],
color_med_atl[3],
color_med_atl[4]))
p1<-p
p<-ggplot(data=data_pca,aes(x=PC3,y=PC4,label=INDIV))+
theme_minimal()+
theme(panel.grid=element_blank(),
panel.border=element_rect(fill="transparent"),
plot.title=element_text(hjust=0.5))+
geom_hline(yintercept=0,lty=2)+
geom_vline(xintercept=0,lty=2)+
geom_point(size=3,aes(col=LOCA))+
xlab(paste("PCA 3 (",round(pca$varprop[3]*100,2),"% )",sep=""))+
ylab(paste("PCA 4 (",round(pca$varprop[4]*100,2),"% )",sep=""))+
scale_colour_manual(name="Location",
values=c(color_med_atl[2],
color_med_atl[1],
color_med_atl[3],
color_med_atl[4]))
p2<-p
data_varpop=data.frame(PC=factor(paste("P",seq(1,10),sep=""),levels=paste("P",seq(1,10),sep="")),VAR=pca$varprop[1:10])
pp<-ggplot(data_varpop,aes(x=PC,y=VAR))+
geom_bar(stat='identity',fill="dodgerblue2",alpha=0.25)+
theme_classic()+
xlab("Principal Component")+
ylab("Variation explained (%)")
```
```{r}
subplot(ggplotly(p1)%>% layout(legend = list(orientation = "h", x = 0.2, y =-0.15)), ggplotly(p2)%>%hide_legend(), ggplotly(pp)%>%hide_legend(), titleX=T,titleY=T,margin=0.035,widths=c(0.375,0.425,0.2),which_layout=1) %>% partial_bundle()
```
### maf = 0.05
```{r}
pca=PCA_list$All_unfiltered$maf0.05[[1]]
data_pca=data.frame(INDIV=pca$sample.id,
PC1=pca$eigenvect[,1],
PC2=pca$eigenvect[,2],
PC3=pca$eigenvect[,3],
PC4=pca$eigenvect[,4],
LOCA=c(rep("Algarve",5),
rep("Bay of Biscay",4),
rep("Gulf of Lion",5),
rep("Costa Calida",0)))
color_med_atl=rev(brewer.pal(n=4,name="RdBu"))
p<-ggplot(data=data_pca,aes(x=PC1,y=PC2,label=INDIV))+
theme_minimal()+
theme(panel.grid=element_blank(),
panel.border=element_rect(fill="transparent"),
plot.title=element_text(hjust=0.5))+
geom_hline(yintercept=0,lty=2)+
geom_vline(xintercept=0,lty=2)+
geom_point(size=3,aes(col=LOCA))+
xlab(paste("PCA 1 (",round(pca$varprop[1]*100,2),"% )",sep=""))+
ylab(paste("PCA 2 (",round(pca$varprop[2]*100,2),"% )",sep=""))+
scale_colour_manual(name="Location",
values=c(color_med_atl[2],
color_med_atl[1],
color_med_atl[3],
color_med_atl[4]))
p1<-p
p<-ggplot(data=data_pca,aes(x=PC3,y=PC4,label=INDIV))+
theme_minimal()+
theme(panel.grid=element_blank(),
panel.border=element_rect(fill="transparent"),
plot.title=element_text(hjust=0.5))+
geom_hline(yintercept=0,lty=2)+
geom_vline(xintercept=0,lty=2)+
geom_point(size=3,aes(col=LOCA))+
xlab(paste("PCA 3 (",round(pca$varprop[3]*100,2),"% )",sep=""))+
ylab(paste("PCA 4 (",round(pca$varprop[4]*100,2),"% )",sep=""))+
scale_colour_manual(name="Location",
values=c(color_med_atl[2],
color_med_atl[1],
color_med_atl[3],
color_med_atl[4]))
p2<-p
data_varpop=data.frame(PC=factor(paste("P",seq(1,10),sep=""),levels=paste("P",seq(1,10),sep="")),VAR=pca$varprop[1:10])
pp<-ggplot(data_varpop,aes(x=PC,y=VAR))+
geom_bar(stat='identity',fill="dodgerblue2",alpha=0.25)+
theme_classic()+
xlab("Principal Component")+
ylab("Variation explained (%)")
```
```{r}
subplot(ggplotly(p1)%>% layout(legend = list(orientation = "h", x = 0.2, y =-0.15)), ggplotly(p2)%>%hide_legend(), ggplotly(pp)%>%hide_legend(), titleX=T,titleY=T,margin=0.035,widths=c(0.375,0.425,0.2),which_layout=1) %>% partial_bundle()
```
### maf = 0.1
```{r}
pca=PCA_list$All_unfiltered$maf0.1[[1]]
data_pca=data.frame(INDIV=pca$sample.id,
PC1=pca$eigenvect[,1],
PC2=pca$eigenvect[,2],
PC3=pca$eigenvect[,3],
PC4=pca$eigenvect[,4],
LOCA=c(rep("Algarve",5),
rep("Bay of Biscay",4),
rep("Gulf of Lion",5),
rep("Costa Calida",0)))
color_med_atl=rev(brewer.pal(n=4,name="RdBu"))
p<-ggplot(data=data_pca,aes(x=PC1,y=PC2,label=INDIV))+
theme_minimal()+
theme(panel.grid=element_blank(),
panel.border=element_rect(fill="transparent"),
plot.title=element_text(hjust=0.5))+
geom_hline(yintercept=0,lty=2)+
geom_vline(xintercept=0,lty=2)+
geom_point(size=3,aes(col=LOCA))+
xlab(paste("PCA 1 (",round(pca$varprop[1]*100,2),"% )",sep=""))+
ylab(paste("PCA 2 (",round(pca$varprop[2]*100,2),"% )",sep=""))+
scale_colour_manual(name="Location",
values=c(color_med_atl[2],
color_med_atl[1],
color_med_atl[3],
color_med_atl[4]))
p1<-p
p<-ggplot(data=data_pca,aes(x=PC3,y=PC4,label=INDIV))+
theme_minimal()+
theme(panel.grid=element_blank(),
panel.border=element_rect(fill="transparent"),
plot.title=element_text(hjust=0.5))+
geom_hline(yintercept=0,lty=2)+
geom_vline(xintercept=0,lty=2)+
geom_point(size=3,aes(col=LOCA))+
xlab(paste("PCA 3 (",round(pca$varprop[3]*100,2),"% )",sep=""))+
ylab(paste("PCA 4 (",round(pca$varprop[4]*100,2),"% )",sep=""))+
scale_colour_manual(name="Location",
values=c(color_med_atl[2],
color_med_atl[1],
color_med_atl[3],
color_med_atl[4]))
p2<-p
data_varpop=data.frame(PC=factor(paste("P",seq(1,10),sep=""),levels=paste("P",seq(1,10),sep="")),VAR=pca$varprop[1:10])
pp<-ggplot(data_varpop,aes(x=PC,y=VAR))+
geom_bar(stat='identity',fill="dodgerblue2",alpha=0.25)+
theme_classic()+
xlab("Principal Component")+
ylab("Variation explained (%)")
```
```{r}
subplot(ggplotly(p1)%>% layout(legend = list(orientation = "h", x = 0.2, y =-0.15)), ggplotly(p2)%>%hide_legend(), ggplotly(pp)%>%hide_legend(), titleX=T,titleY=T,margin=0.035,widths=c(0.375,0.425,0.2),which_layout=1) %>% partial_bundle()
```
### maf = 0.15
```{r}
pca=PCA_list$All_unfiltered$maf0.15[[1]]
data_pca=data.frame(INDIV=pca$sample.id,
PC1=pca$eigenvect[,1],
PC2=pca$eigenvect[,2],
PC3=pca$eigenvect[,3],
PC4=pca$eigenvect[,4],
LOCA=c(rep("Algarve",5),
rep("Bay of Biscay",4),
rep("Gulf of Lion",5),
rep("Costa Calida",0)))
color_med_atl=rev(brewer.pal(n=4,name="RdBu"))
p<-ggplot(data=data_pca,aes(x=PC1,y=PC2,label=INDIV))+
theme_minimal()+
theme(panel.grid=element_blank(),
panel.border=element_rect(fill="transparent"),
plot.title=element_text(hjust=0.5))+
geom_hline(yintercept=0,lty=2)+
geom_vline(xintercept=0,lty=2)+
geom_point(size=3,aes(col=LOCA))+
xlab(paste("PCA 1 (",round(pca$varprop[1]*100,2),"% )",sep=""))+
ylab(paste("PCA 2 (",round(pca$varprop[2]*100,2),"% )",sep=""))+
scale_colour_manual(name="Location",
values=c(color_med_atl[2],
color_med_atl[1],
color_med_atl[3],
color_med_atl[4]))
p1<-p
p<-ggplot(data=data_pca,aes(x=PC3,y=PC4,label=INDIV))+
theme_minimal()+
theme(panel.grid=element_blank(),
panel.border=element_rect(fill="transparent"),
plot.title=element_text(hjust=0.5))+
geom_hline(yintercept=0,lty=2)+
geom_vline(xintercept=0,lty=2)+
geom_point(size=3,aes(col=LOCA))+
xlab(paste("PCA 3 (",round(pca$varprop[3]*100,2),"% )",sep=""))+
ylab(paste("PCA 4 (",round(pca$varprop[4]*100,2),"% )",sep=""))+
scale_colour_manual(name="Location",
values=c(color_med_atl[2],
color_med_atl[1],
color_med_atl[3],
color_med_atl[4]))
p2<-p
data_varpop=data.frame(PC=factor(paste("P",seq(1,10),sep=""),levels=paste("P",seq(1,10),sep="")),VAR=pca$varprop[1:10])
pp<-ggplot(data_varpop,aes(x=PC,y=VAR))+
geom_bar(stat='identity',fill="dodgerblue2",alpha=0.25)+
theme_classic()+
xlab("Principal Component")+
ylab("Variation explained (%)")
```
```{r}
subplot(ggplotly(p1)%>% layout(legend = list(orientation = "h", x = 0.2, y =-0.15)), ggplotly(p2)%>%hide_legend(), ggplotly(pp)%>%hide_legend(), titleX=T,titleY=T,margin=0.035,widths=c(0.375,0.425,0.2),which_layout=1) %>% partial_bundle()
```
### maf = 0.20
```{r}
pca=PCA_list$All_unfiltered$maf0.2[[1]]
data_pca=data.frame(INDIV=pca$sample.id,
PC1=pca$eigenvect[,1],
PC2=pca$eigenvect[,2],
PC3=pca$eigenvect[,3],
PC4=pca$eigenvect[,4],
LOCA=c(rep("Algarve",5),
rep("Bay of Biscay",4),
rep("Gulf of Lion",5),
rep("Costa Calida",0)))
color_med_atl=rev(brewer.pal(n=4,name="RdBu"))
p<-ggplot(data=data_pca,aes(x=PC1,y=PC2,label=INDIV))+
theme_minimal()+
theme(panel.grid=element_blank(),
panel.border=element_rect(fill="transparent"),
plot.title=element_text(hjust=0.5))+
geom_hline(yintercept=0,lty=2)+
geom_vline(xintercept=0,lty=2)+
geom_point(size=3,aes(col=LOCA))+
xlab(paste("PCA 1 (",round(pca$varprop[1]*100,2),"% )",sep=""))+
ylab(paste("PCA 2 (",round(pca$varprop[2]*100,2),"% )",sep=""))+
scale_colour_manual(name="Location",
values=c(color_med_atl[2],
color_med_atl[1],
color_med_atl[3],
color_med_atl[4]))
p1<-p
p<-ggplot(data=data_pca,aes(x=PC3,y=PC4,label=INDIV))+
theme_minimal()+
theme(panel.grid=element_blank(),
panel.border=element_rect(fill="transparent"),
plot.title=element_text(hjust=0.5))+
geom_hline(yintercept=0,lty=2)+
geom_vline(xintercept=0,lty=2)+
geom_point(size=3,aes(col=LOCA))+
xlab(paste("PCA 3 (",round(pca$varprop[3]*100,2),"% )",sep=""))+
ylab(paste("PCA 4 (",round(pca$varprop[4]*100,2),"% )",sep=""))+
scale_colour_manual(name="Location",
values=c(color_med_atl[2],
color_med_atl[1],
color_med_atl[3],
color_med_atl[4]))
p2<-p
data_varpop=data.frame(PC=factor(paste("P",seq(1,10),sep=""),levels=paste("P",seq(1,10),sep="")),VAR=pca$varprop[1:10])
pp<-ggplot(data_varpop,aes(x=PC,y=VAR))+
geom_bar(stat='identity',fill="dodgerblue2",alpha=0.25)+
theme_classic()+
xlab("Principal Component")+
ylab("Variation explained (%)")
```
```{r}
subplot(ggplotly(p1)%>% layout(legend = list(orientation = "h", x = 0.2, y =-0.15)), ggplotly(p2)%>%hide_legend(), ggplotly(pp)%>%hide_legend(), titleX=T,titleY=T,margin=0.035,widths=c(0.375,0.425,0.2),which_layout=1) %>% partial_bundle()
```
### maf = 0.25
```{r}
pca=PCA_list$All_unfiltered$maf0.25[[1]]
data_pca=data.frame(INDIV=pca$sample.id,
PC1=pca$eigenvect[,1],
PC2=pca$eigenvect[,2],
PC3=pca$eigenvect[,3],
PC4=pca$eigenvect[,4],
LOCA=c(rep("Algarve",5),
rep("Bay of Biscay",4),
rep("Gulf of Lion",5),
rep("Costa Calida",0)))
color_med_atl=rev(brewer.pal(n=4,name="RdBu"))
p<-ggplot(data=data_pca,aes(x=PC1,y=PC2,label=INDIV))+
theme_minimal()+
theme(panel.grid=element_blank(),
panel.border=element_rect(fill="transparent"),
plot.title=element_text(hjust=0.5))+
geom_hline(yintercept=0,lty=2)+
geom_vline(xintercept=0,lty=2)+
geom_point(size=3,aes(col=LOCA))+
xlab(paste("PCA 1 (",round(pca$varprop[1]*100,2),"% )",sep=""))+
ylab(paste("PCA 2 (",round(pca$varprop[2]*100,2),"% )",sep=""))+
scale_colour_manual(name="Location",
values=c(color_med_atl[2],
color_med_atl[1],
color_med_atl[3],
color_med_atl[4]))
p1<-p
p<-ggplot(data=data_pca,aes(x=PC3,y=PC4,label=INDIV))+
theme_minimal()+
theme(panel.grid=element_blank(),
panel.border=element_rect(fill="transparent"),
plot.title=element_text(hjust=0.5))+
geom_hline(yintercept=0,lty=2)+
geom_vline(xintercept=0,lty=2)+
geom_point(size=3,aes(col=LOCA))+
xlab(paste("PCA 3 (",round(pca$varprop[3]*100,2),"% )",sep=""))+
ylab(paste("PCA 4 (",round(pca$varprop[4]*100,2),"% )",sep=""))+
scale_colour_manual(name="Location",
values=c(color_med_atl[2],
color_med_atl[1],
color_med_atl[3],
color_med_atl[4]))
p2<-p
data_varpop=data.frame(PC=factor(paste("P",seq(1,10),sep=""),levels=paste("P",seq(1,10),sep="")),VAR=pca$varprop[1:10])
pp<-ggplot(data_varpop,aes(x=PC,y=VAR))+
geom_bar(stat='identity',fill="dodgerblue2",alpha=0.25)+
theme_classic()+
xlab("Principal Component")+
ylab("Variation explained (%)")
```
```{r}
subplot(ggplotly(p1)%>% layout(legend = list(orientation = "h", x = 0.2, y =-0.15)), ggplotly(p2)%>%hide_legend(), ggplotly(pp)%>%hide_legend(), titleX=T,titleY=T,margin=0.035,widths=c(0.375,0.425,0.2),which_layout=1) %>% partial_bundle()
```
### maf = 0.30
```{r}
pca=PCA_list$All_unfiltered$maf0.3[[1]]
data_pca=data.frame(INDIV=pca$sample.id,
PC1=pca$eigenvect[,1],
PC2=pca$eigenvect[,2],
PC3=pca$eigenvect[,3],
PC4=pca$eigenvect[,4],
LOCA=c(rep("Algarve",5),
rep("Bay of Biscay",4),
rep("Gulf of Lion",5),
rep("Costa Calida",0)))
color_med_atl=rev(brewer.pal(n=4,name="RdBu"))
p<-ggplot(data=data_pca,aes(x=PC1,y=PC2,label=INDIV))+
theme_minimal()+
theme(panel.grid=element_blank(),
panel.border=element_rect(fill="transparent"),
plot.title=element_text(hjust=0.5))+
geom_hline(yintercept=0,lty=2)+
geom_vline(xintercept=0,lty=2)+
geom_point(size=3,aes(col=LOCA))+
xlab(paste("PCA 1 (",round(pca$varprop[1]*100,2),"% )",sep=""))+
ylab(paste("PCA 2 (",round(pca$varprop[2]*100,2),"% )",sep=""))+
scale_colour_manual(name="Location",
values=c(color_med_atl[2],
color_med_atl[1],
color_med_atl[3],
color_med_atl[4]))
p1<-p
p<-ggplot(data=data_pca,aes(x=PC3,y=PC4,label=INDIV))+
theme_minimal()+
theme(panel.grid=element_blank(),
panel.border=element_rect(fill="transparent"),
plot.title=element_text(hjust=0.5))+
geom_hline(yintercept=0,lty=2)+
geom_vline(xintercept=0,lty=2)+
geom_point(size=3,aes(col=LOCA))+
xlab(paste("PCA 3 (",round(pca$varprop[3]*100,2),"% )",sep=""))+
ylab(paste("PCA 4 (",round(pca$varprop[4]*100,2),"% )",sep=""))+
scale_colour_manual(name="Location",
values=c(color_med_atl[2],
color_med_atl[1],
color_med_atl[3],
color_med_atl[4]))
p2<-p
data_varpop=data.frame(PC=factor(paste("P",seq(1,10),sep=""),levels=paste("P",seq(1,10),sep="")),VAR=pca$varprop[1:10])
pp<-ggplot(data_varpop,aes(x=PC,y=VAR))+
geom_bar(stat='identity',fill="dodgerblue2",alpha=0.25)+
theme_classic()+
xlab("Principal Component")+
ylab("Variation explained (%)")
```
```{r}
subplot(ggplotly(p1)%>% layout(legend = list(orientation = "h", x = 0.2, y =-0.15)), ggplotly(p2)%>%hide_legend(), ggplotly(pp)%>%hide_legend(), titleX=T,titleY=T,margin=0.035,widths=c(0.375,0.425,0.2),which_layout=1) %>% partial_bundle()
```
### maf = 0.35
```{r}
pca=PCA_list$All_unfiltered$maf0.35[[1]]
data_pca=data.frame(INDIV=pca$sample.id,
PC1=pca$eigenvect[,1],
PC2=pca$eigenvect[,2],
PC3=pca$eigenvect[,3],
PC4=pca$eigenvect[,4],
LOCA=c(rep("Algarve",5),
rep("Bay of Biscay",4),
rep("Gulf of Lion",5),
rep("Costa Calida",0)))
color_med_atl=rev(brewer.pal(n=4,name="RdBu"))
p<-ggplot(data=data_pca,aes(x=PC1,y=PC2,label=INDIV))+
theme_minimal()+
theme(panel.grid=element_blank(),
panel.border=element_rect(fill="transparent"),
plot.title=element_text(hjust=0.5))+
geom_hline(yintercept=0,lty=2)+
geom_vline(xintercept=0,lty=2)+
geom_point(size=3,aes(col=LOCA))+
xlab(paste("PCA 1 (",round(pca$varprop[1]*100,2),"% )",sep=""))+
ylab(paste("PCA 2 (",round(pca$varprop[2]*100,2),"% )",sep=""))+
scale_colour_manual(name="Location",
values=c(color_med_atl[2],
color_med_atl[1],
color_med_atl[3],
color_med_atl[4]))
p1<-p
p<-ggplot(data=data_pca,aes(x=PC3,y=PC4,label=INDIV))+
theme_minimal()+
theme(panel.grid=element_blank(),
panel.border=element_rect(fill="transparent"),
plot.title=element_text(hjust=0.5))+
geom_hline(yintercept=0,lty=2)+
geom_vline(xintercept=0,lty=2)+
geom_point(size=3,aes(col=LOCA))+
xlab(paste("PCA 3 (",round(pca$varprop[3]*100,2),"% )",sep=""))+
ylab(paste("PCA 4 (",round(pca$varprop[4]*100,2),"% )",sep=""))+
scale_colour_manual(name="Location",
values=c(color_med_atl[2],
color_med_atl[1],
color_med_atl[3],
color_med_atl[4]))
p2<-p
data_varpop=data.frame(PC=factor(paste("P",seq(1,10),sep=""),levels=paste("P",seq(1,10),sep="")),VAR=pca$varprop[1:10])
pp<-ggplot(data_varpop,aes(x=PC,y=VAR))+
geom_bar(stat='identity',fill="dodgerblue2",alpha=0.25)+
theme_classic()+
xlab("Principal Component")+
ylab("Variation explained (%)")
```
```{r}
subplot(ggplotly(p1)%>% layout(legend = list(orientation = "h", x = 0.2, y =-0.15)), ggplotly(p2)%>%hide_legend(), ggplotly(pp)%>%hide_legend(), titleX=T,titleY=T,margin=0.035,widths=c(0.375,0.425,0.2),which_layout=1) %>% partial_bundle()
```
### maf = 0.40
```{r}
pca=PCA_list$All_unfiltered$maf0.4[[1]]
data_pca=data.frame(INDIV=pca$sample.id,
PC1=pca$eigenvect[,1],
PC2=pca$eigenvect[,2],
PC3=pca$eigenvect[,3],
PC4=pca$eigenvect[,4],
LOCA=c(rep("Algarve",5),
rep("Bay of Biscay",4),
rep("Gulf of Lion",5),
rep("Costa Calida",0)))
color_med_atl=rev(brewer.pal(n=4,name="RdBu"))
p<-ggplot(data=data_pca,aes(x=PC1,y=PC2,label=INDIV))+
theme_minimal()+
theme(panel.grid=element_blank(),
panel.border=element_rect(fill="transparent"),
plot.title=element_text(hjust=0.5))+
geom_hline(yintercept=0,lty=2)+
geom_vline(xintercept=0,lty=2)+
geom_point(size=3,aes(col=LOCA))+
xlab(paste("PCA 1 (",round(pca$varprop[1]*100,2),"% )",sep=""))+
ylab(paste("PCA 2 (",round(pca$varprop[2]*100,2),"% )",sep=""))+
scale_colour_manual(name="Location",
values=c(color_med_atl[2],
color_med_atl[1],
color_med_atl[3],
color_med_atl[4]))
p1<-p
p<-ggplot(data=data_pca,aes(x=PC3,y=PC4,label=INDIV))+
theme_minimal()+
theme(panel.grid=element_blank(),
panel.border=element_rect(fill="transparent"),
plot.title=element_text(hjust=0.5))+
geom_hline(yintercept=0,lty=2)+
geom_vline(xintercept=0,lty=2)+
geom_point(size=3,aes(col=LOCA))+
xlab(paste("PCA 3 (",round(pca$varprop[3]*100,2),"% )",sep=""))+
ylab(paste("PCA 4 (",round(pca$varprop[4]*100,2),"% )",sep=""))+
scale_colour_manual(name="Location",
values=c(color_med_atl[2],
color_med_atl[1],
color_med_atl[3],
color_med_atl[4]))
p2<-p
data_varpop=data.frame(PC=factor(paste("P",seq(1,10),sep=""),levels=paste("P",seq(1,10),sep="")),VAR=pca$varprop[1:10])
pp<-ggplot(data_varpop,aes(x=PC,y=VAR))+
geom_bar(stat='identity',fill="dodgerblue2",alpha=0.25)+
theme_classic()+
xlab("Principal Component")+
ylab("Variation explained (%)")
```
```{r}
subplot(ggplotly(p1)%>% layout(legend = list(orientation = "h", x = 0.2, y =-0.15)), ggplotly(p2)%>%hide_legend(), ggplotly(pp)%>%hide_legend(), titleX=T,titleY=T,margin=0.035,widths=c(0.375,0.425,0.2),which_layout=1) %>% partial_bundle()
```
### maf = 0.45
```{r}
pca=PCA_list$All_unfiltered$maf0.45[[1]]
data_pca=data.frame(INDIV=pca$sample.id,
PC1=pca$eigenvect[,1],
PC2=pca$eigenvect[,2],
PC3=pca$eigenvect[,3],
PC4=pca$eigenvect[,4],
LOCA=c(rep("Algarve",5),
rep("Bay of Biscay",4),
rep("Gulf of Lion",5),
rep("Costa Calida",0)))
color_med_atl=rev(brewer.pal(n=4,name="RdBu"))
p<-ggplot(data=data_pca,aes(x=PC1,y=PC2,label=INDIV))+
theme_minimal()+
theme(panel.grid=element_blank(),
panel.border=element_rect(fill="transparent"),
plot.title=element_text(hjust=0.5))+
geom_hline(yintercept=0,lty=2)+
geom_vline(xintercept=0,lty=2)+
geom_point(size=3,aes(col=LOCA))+
xlab(paste("PCA 1 (",round(pca$varprop[1]*100,2),"% )",sep=""))+
ylab(paste("PCA 2 (",round(pca$varprop[2]*100,2),"% )",sep=""))+
scale_colour_manual(name="Location",
values=c(color_med_atl[2],
color_med_atl[1],
color_med_atl[3],
color_med_atl[4]))
p1<-p
p<-ggplot(data=data_pca,aes(x=PC3,y=PC4,label=INDIV))+
theme_minimal()+
theme(panel.grid=element_blank(),
panel.border=element_rect(fill="transparent"),
plot.title=element_text(hjust=0.5))+
geom_hline(yintercept=0,lty=2)+
geom_vline(xintercept=0,lty=2)+
geom_point(size=3,aes(col=LOCA))+
xlab(paste("PCA 3 (",round(pca$varprop[3]*100,2),"% )",sep=""))+
ylab(paste("PCA 4 (",round(pca$varprop[4]*100,2),"% )",sep=""))+
scale_colour_manual(name="Location",
values=c(color_med_atl[2],
color_med_atl[1],
color_med_atl[3],
color_med_atl[4]))
p2<-p
data_varpop=data.frame(PC=factor(paste("P",seq(1,10),sep=""),levels=paste("P",seq(1,10),sep="")),VAR=pca$varprop[1:10])
pp<-ggplot(data_varpop,aes(x=PC,y=VAR))+
geom_bar(stat='identity',fill="dodgerblue2",alpha=0.25)+
theme_classic()+
xlab("Principal Component")+
ylab("Variation explained (%)")
```
```{r}
subplot(ggplotly(p1)%>% layout(legend = list(orientation = "h", x = 0.2, y =-0.15)), ggplotly(p2)%>%hide_legend(), ggplotly(pp)%>%hide_legend(), titleX=T,titleY=T,margin=0.035,widths=c(0.375,0.425,0.2),which_layout=1) %>% partial_bundle()
```
### maf = 0.50
```{r}
pca=PCA_list$All_unfiltered$maf0.5[[1]]
data_pca=data.frame(INDIV=pca$sample.id,
PC1=pca$eigenvect[,1],
PC2=pca$eigenvect[,2],
PC3=pca$eigenvect[,3],
PC4=pca$eigenvect[,4],
LOCA=c(rep("Algarve",5),
rep("Bay of Biscay",4),
rep("Gulf of Lion",5),
rep("Costa Calida",0)))
color_med_atl=rev(brewer.pal(n=4,name="RdBu"))
p<-ggplot(data=data_pca,aes(x=PC1,y=PC2,label=INDIV))+
theme_minimal()+
theme(panel.grid=element_blank(),
panel.border=element_rect(fill="transparent"),
plot.title=element_text(hjust=0.5))+
geom_hline(yintercept=0,lty=2)+
geom_vline(xintercept=0,lty=2)+
geom_point(size=3,aes(col=LOCA))+
xlab(paste("PCA 1 (",round(pca$varprop[1]*100,2),"% )",sep=""))+
ylab(paste("PCA 2 (",round(pca$varprop[2]*100,2),"% )",sep=""))+
scale_colour_manual(name="Location",
values=c(color_med_atl[2],
color_med_atl[1],
color_med_atl[3],
color_med_atl[4]))
p1<-p
p<-ggplot(data=data_pca,aes(x=PC3,y=PC4,label=INDIV))+
theme_minimal()+
theme(panel.grid=element_blank(),
panel.border=element_rect(fill="transparent"),
plot.title=element_text(hjust=0.5))+
geom_hline(yintercept=0,lty=2)+
geom_vline(xintercept=0,lty=2)+
geom_point(size=3,aes(col=LOCA))+
xlab(paste("PCA 3 (",round(pca$varprop[3]*100,2),"% )",sep=""))+
ylab(paste("PCA 4 (",round(pca$varprop[4]*100,2),"% )",sep=""))+
scale_colour_manual(name="Location",
values=c(color_med_atl[2],
color_med_atl[1],
color_med_atl[3],
color_med_atl[4]))
p2<-p
data_varpop=data.frame(PC=factor(paste("P",seq(1,10),sep=""),levels=paste("P",seq(1,10),sep="")),VAR=pca$varprop[1:10])
pp<-ggplot(data_varpop,aes(x=PC,y=VAR))+
geom_bar(stat='identity',fill="dodgerblue2",alpha=0.25)+
theme_classic()+
xlab("Principal Component")+
ylab("Variation explained (%)")
```
```{r}
subplot(ggplotly(p1)%>% layout(legend = list(orientation = "h", x = 0.2, y =-0.15)), ggplotly(p2)%>%hide_legend(), ggplotly(pp)%>%hide_legend(), titleX=T,titleY=T,margin=0.035,widths=c(0.375,0.425,0.2),which_layout=1) %>% partial_bundle()
```
Row {.tabset data-height=50}
-----------------------
<center>
<font size="6">**Pruned unfiltered SNPS**</font>
</center>
Row {.tabset data-height=600}
-----------------------
### maf = 0
```{r}
pca=PCA_list$Prune_unfiltered$maf0[[1]]
data_pca=data.frame(INDIV=pca$sample.id,
PC1=pca$eigenvect[,1],
PC2=pca$eigenvect[,2],
PC3=pca$eigenvect[,3],
PC4=pca$eigenvect[,4],
LOCA=c(rep("Algarve",5),
rep("Bay of Biscay",4),
rep("Gulf of Lion",5),
rep("Costa Calida",0)))
color_med_atl=rev(brewer.pal(n=4,name="RdBu"))
p<-ggplot(data=data_pca,aes(x=PC1,y=PC2,label=INDIV))+
theme_minimal()+
theme(panel.grid=element_blank(),
panel.border=element_rect(fill="transparent"),
plot.title=element_text(hjust=0.5))+
geom_hline(yintercept=0,lty=2)+
geom_vline(xintercept=0,lty=2)+
geom_point(size=3,aes(col=LOCA))+
xlab(paste("PCA 1 (",round(pca$varprop[1]*100,2),"% )",sep=""))+
ylab(paste("PCA 2 (",round(pca$varprop[2]*100,2),"% )",sep=""))+
scale_colour_manual(name="Location",
values=c(color_med_atl[2],
color_med_atl[1],
color_med_atl[3],
color_med_atl[4]))
p1<-p
p<-ggplot(data=data_pca,aes(x=PC3,y=PC4,label=INDIV))+
theme_minimal()+
theme(panel.grid=element_blank(),
panel.border=element_rect(fill="transparent"),
plot.title=element_text(hjust=0.5))+
geom_hline(yintercept=0,lty=2)+
geom_vline(xintercept=0,lty=2)+
geom_point(size=3,aes(col=LOCA))+
xlab(paste("PCA 3 (",round(pca$varprop[3]*100,2),"% )",sep=""))+
ylab(paste("PCA 4 (",round(pca$varprop[4]*100,2),"% )",sep=""))+
scale_colour_manual(name="Location",
values=c(color_med_atl[2],
color_med_atl[1],
color_med_atl[3],
color_med_atl[4]))
p2<-p
data_varpop=data.frame(PC=factor(paste("P",seq(1,10),sep=""),levels=paste("P",seq(1,10),sep="")),VAR=pca$varprop[1:10])
pp<-ggplot(data_varpop,aes(x=PC,y=VAR))+
geom_bar(stat='identity',fill="dodgerblue2",alpha=0.25)+
theme_classic()+
xlab("Principal Component")+
ylab("Variation explained (%)")
```
```{r}
subplot(ggplotly(p1)%>% layout(legend = list(orientation = "h", x = 0.2, y =-0.15)), ggplotly(p2)%>%hide_legend(), ggplotly(pp)%>%hide_legend(), titleX=T,titleY=T,margin=0.035,widths=c(0.375,0.425,0.2),which_layout=1) %>% partial_bundle()
```
### maf = 0.05
```{r}
pca=PCA_list$Prune_unfiltered$maf0.05[[1]]
data_pca=data.frame(INDIV=pca$sample.id,
PC1=pca$eigenvect[,1],
PC2=pca$eigenvect[,2],
PC3=pca$eigenvect[,3],
PC4=pca$eigenvect[,4],
LOCA=c(rep("Algarve",5),
rep("Bay of Biscay",4),
rep("Gulf of Lion",5),
rep("Costa Calida",0)))
color_med_atl=rev(brewer.pal(n=4,name="RdBu"))
p<-ggplot(data=data_pca,aes(x=PC1,y=PC2,label=INDIV))+
theme_minimal()+
theme(panel.grid=element_blank(),
panel.border=element_rect(fill="transparent"),
plot.title=element_text(hjust=0.5))+
geom_hline(yintercept=0,lty=2)+
geom_vline(xintercept=0,lty=2)+
geom_point(size=3,aes(col=LOCA))+
xlab(paste("PCA 1 (",round(pca$varprop[1]*100,2),"% )",sep=""))+
ylab(paste("PCA 2 (",round(pca$varprop[2]*100,2),"% )",sep=""))+
scale_colour_manual(name="Location",
values=c(color_med_atl[2],
color_med_atl[1],
color_med_atl[3],
color_med_atl[4]))
p1<-p
p<-ggplot(data=data_pca,aes(x=PC3,y=PC4,label=INDIV))+
theme_minimal()+
theme(panel.grid=element_blank(),
panel.border=element_rect(fill="transparent"),
plot.title=element_text(hjust=0.5))+
geom_hline(yintercept=0,lty=2)+
geom_vline(xintercept=0,lty=2)+
geom_point(size=3,aes(col=LOCA))+
xlab(paste("PCA 3 (",round(pca$varprop[3]*100,2),"% )",sep=""))+
ylab(paste("PCA 4 (",round(pca$varprop[4]*100,2),"% )",sep=""))+
scale_colour_manual(name="Location",
values=c(color_med_atl[2],
color_med_atl[1],
color_med_atl[3],
color_med_atl[4]))
p2<-p
data_varpop=data.frame(PC=factor(paste("P",seq(1,10),sep=""),levels=paste("P",seq(1,10),sep="")),VAR=pca$varprop[1:10])
pp<-ggplot(data_varpop,aes(x=PC,y=VAR))+
geom_bar(stat='identity',fill="dodgerblue2",alpha=0.25)+
theme_classic()+
xlab("Principal Component")+
ylab("Variation explained (%)")
```
```{r}
subplot(ggplotly(p1)%>% layout(legend = list(orientation = "h", x = 0.2, y =-0.15)), ggplotly(p2)%>%hide_legend(), ggplotly(pp)%>%hide_legend(), titleX=T,titleY=T,margin=0.035,widths=c(0.375,0.425,0.2),which_layout=1) %>% partial_bundle()
```
### maf = 0.1
```{r}
pca=PCA_list$Prune_unfiltered$maf0.1[[1]]
data_pca=data.frame(INDIV=pca$sample.id,
PC1=pca$eigenvect[,1],
PC2=pca$eigenvect[,2],
PC3=pca$eigenvect[,3],
PC4=pca$eigenvect[,4],
LOCA=c(rep("Algarve",5),
rep("Bay of Biscay",4),
rep("Gulf of Lion",5),
rep("Costa Calida",0)))
color_med_atl=rev(brewer.pal(n=4,name="RdBu"))
p<-ggplot(data=data_pca,aes(x=PC1,y=PC2,label=INDIV))+
theme_minimal()+
theme(panel.grid=element_blank(),
panel.border=element_rect(fill="transparent"),
plot.title=element_text(hjust=0.5))+
geom_hline(yintercept=0,lty=2)+
geom_vline(xintercept=0,lty=2)+
geom_point(size=3,aes(col=LOCA))+
xlab(paste("PCA 1 (",round(pca$varprop[1]*100,2),"% )",sep=""))+
ylab(paste("PCA 2 (",round(pca$varprop[2]*100,2),"% )",sep=""))+
scale_colour_manual(name="Location",
values=c(color_med_atl[2],
color_med_atl[1],
color_med_atl[3],
color_med_atl[4]))
p1<-p
p<-ggplot(data=data_pca,aes(x=PC3,y=PC4,label=INDIV))+
theme_minimal()+
theme(panel.grid=element_blank(),
panel.border=element_rect(fill="transparent"),
plot.title=element_text(hjust=0.5))+
geom_hline(yintercept=0,lty=2)+
geom_vline(xintercept=0,lty=2)+
geom_point(size=3,aes(col=LOCA))+
xlab(paste("PCA 3 (",round(pca$varprop[3]*100,2),"% )",sep=""))+
ylab(paste("PCA 4 (",round(pca$varprop[4]*100,2),"% )",sep=""))+
scale_colour_manual(name="Location",
values=c(color_med_atl[2],
color_med_atl[1],
color_med_atl[3],
color_med_atl[4]))
p2<-p
data_varpop=data.frame(PC=factor(paste("P",seq(1,10),sep=""),levels=paste("P",seq(1,10),sep="")),VAR=pca$varprop[1:10])
pp<-ggplot(data_varpop,aes(x=PC,y=VAR))+
geom_bar(stat='identity',fill="dodgerblue2",alpha=0.25)+
theme_classic()+
xlab("Principal Component")+
ylab("Variation explained (%)")
```
```{r}
subplot(ggplotly(p1)%>% layout(legend = list(orientation = "h", x = 0.2, y =-0.15)), ggplotly(p2)%>%hide_legend(), ggplotly(pp)%>%hide_legend(), titleX=T,titleY=T,margin=0.035,widths=c(0.375,0.425,0.2),which_layout=1) %>% partial_bundle()
```
### maf = 0.15
```{r}
pca=PCA_list$Prune_unfiltered$maf0.15[[1]]
data_pca=data.frame(INDIV=pca$sample.id,
PC1=pca$eigenvect[,1],
PC2=pca$eigenvect[,2],
PC3=pca$eigenvect[,3],
PC4=pca$eigenvect[,4],
LOCA=c(rep("Algarve",5),
rep("Bay of Biscay",4),
rep("Gulf of Lion",5),
rep("Costa Calida",0)))
color_med_atl=rev(brewer.pal(n=4,name="RdBu"))
p<-ggplot(data=data_pca,aes(x=PC1,y=PC2,label=INDIV))+
theme_minimal()+
theme(panel.grid=element_blank(),
panel.border=element_rect(fill="transparent"),
plot.title=element_text(hjust=0.5))+
geom_hline(yintercept=0,lty=2)+
geom_vline(xintercept=0,lty=2)+
geom_point(size=3,aes(col=LOCA))+
xlab(paste("PCA 1 (",round(pca$varprop[1]*100,2),"% )",sep=""))+
ylab(paste("PCA 2 (",round(pca$varprop[2]*100,2),"% )",sep=""))+
scale_colour_manual(name="Location",
values=c(color_med_atl[2],
color_med_atl[1],
color_med_atl[3],
color_med_atl[4]))
p1<-p
p<-ggplot(data=data_pca,aes(x=PC3,y=PC4,label=INDIV))+
theme_minimal()+
theme(panel.grid=element_blank(),
panel.border=element_rect(fill="transparent"),
plot.title=element_text(hjust=0.5))+
geom_hline(yintercept=0,lty=2)+
geom_vline(xintercept=0,lty=2)+
geom_point(size=3,aes(col=LOCA))+
xlab(paste("PCA 3 (",round(pca$varprop[3]*100,2),"% )",sep=""))+
ylab(paste("PCA 4 (",round(pca$varprop[4]*100,2),"% )",sep=""))+
scale_colour_manual(name="Location",
values=c(color_med_atl[2],
color_med_atl[1],
color_med_atl[3],
color_med_atl[4]))
p2<-p
data_varpop=data.frame(PC=factor(paste("P",seq(1,10),sep=""),levels=paste("P",seq(1,10),sep="")),VAR=pca$varprop[1:10])
pp<-ggplot(data_varpop,aes(x=PC,y=VAR))+
geom_bar(stat='identity',fill="dodgerblue2",alpha=0.25)+
theme_classic()+
xlab("Principal Component")+
ylab("Variation explained (%)")
```
```{r}
subplot(ggplotly(p1)%>% layout(legend = list(orientation = "h", x = 0.2, y =-0.15)), ggplotly(p2)%>%hide_legend(), ggplotly(pp)%>%hide_legend(), titleX=T,titleY=T,margin=0.035,widths=c(0.375,0.425,0.2),which_layout=1) %>% partial_bundle()
```
### maf = 0.20
```{r}
pca=PCA_list$Prune_unfiltered$maf0.2[[1]]
data_pca=data.frame(INDIV=pca$sample.id,
PC1=pca$eigenvect[,1],
PC2=pca$eigenvect[,2],
PC3=pca$eigenvect[,3],
PC4=pca$eigenvect[,4],
LOCA=c(rep("Algarve",5),
rep("Bay of Biscay",4),
rep("Gulf of Lion",5),
rep("Costa Calida",0)))
color_med_atl=rev(brewer.pal(n=4,name="RdBu"))
p<-ggplot(data=data_pca,aes(x=PC1,y=PC2,label=INDIV))+
theme_minimal()+
theme(panel.grid=element_blank(),
panel.border=element_rect(fill="transparent"),
plot.title=element_text(hjust=0.5))+
geom_hline(yintercept=0,lty=2)+
geom_vline(xintercept=0,lty=2)+
geom_point(size=3,aes(col=LOCA))+
xlab(paste("PCA 1 (",round(pca$varprop[1]*100,2),"% )",sep=""))+
ylab(paste("PCA 2 (",round(pca$varprop[2]*100,2),"% )",sep=""))+
scale_colour_manual(name="Location",
values=c(color_med_atl[2],
color_med_atl[1],
color_med_atl[3],
color_med_atl[4]))
p1<-p
p<-ggplot(data=data_pca,aes(x=PC3,y=PC4,label=INDIV))+
theme_minimal()+
theme(panel.grid=element_blank(),
panel.border=element_rect(fill="transparent"),
plot.title=element_text(hjust=0.5))+
geom_hline(yintercept=0,lty=2)+
geom_vline(xintercept=0,lty=2)+
geom_point(size=3,aes(col=LOCA))+
xlab(paste("PCA 3 (",round(pca$varprop[3]*100,2),"% )",sep=""))+
ylab(paste("PCA 4 (",round(pca$varprop[4]*100,2),"% )",sep=""))+
scale_colour_manual(name="Location",
values=c(color_med_atl[2],
color_med_atl[1],
color_med_atl[3],
color_med_atl[4]))
p2<-p
data_varpop=data.frame(PC=factor(paste("P",seq(1,10),sep=""),levels=paste("P",seq(1,10),sep="")),VAR=pca$varprop[1:10])
pp<-ggplot(data_varpop,aes(x=PC,y=VAR))+
geom_bar(stat='identity',fill="dodgerblue2",alpha=0.25)+
theme_classic()+
xlab("Principal Component")+
ylab("Variation explained (%)")
```
```{r}
subplot(ggplotly(p1)%>% layout(legend = list(orientation = "h", x = 0.2, y =-0.15)), ggplotly(p2)%>%hide_legend(), ggplotly(pp)%>%hide_legend(), titleX=T,titleY=T,margin=0.035,widths=c(0.375,0.425,0.2),which_layout=1) %>% partial_bundle()
```
### maf = 0.25
```{r}
pca=PCA_list$Prune_unfiltered$maf0.25[[1]]
data_pca=data.frame(INDIV=pca$sample.id,
PC1=pca$eigenvect[,1],
PC2=pca$eigenvect[,2],
PC3=pca$eigenvect[,3],
PC4=pca$eigenvect[,4],
LOCA=c(rep("Algarve",5),
rep("Bay of Biscay",4),
rep("Gulf of Lion",5),
rep("Costa Calida",0)))
color_med_atl=rev(brewer.pal(n=4,name="RdBu"))
p<-ggplot(data=data_pca,aes(x=PC1,y=PC2,label=INDIV))+
theme_minimal()+
theme(panel.grid=element_blank(),
panel.border=element_rect(fill="transparent"),
plot.title=element_text(hjust=0.5))+
geom_hline(yintercept=0,lty=2)+
geom_vline(xintercept=0,lty=2)+
geom_point(size=3,aes(col=LOCA))+
xlab(paste("PCA 1 (",round(pca$varprop[1]*100,2),"% )",sep=""))+
ylab(paste("PCA 2 (",round(pca$varprop[2]*100,2),"% )",sep=""))+
scale_colour_manual(name="Location",
values=c(color_med_atl[2],
color_med_atl[1],
color_med_atl[3],
color_med_atl[4]))
p1<-p
p<-ggplot(data=data_pca,aes(x=PC3,y=PC4,label=INDIV))+
theme_minimal()+
theme(panel.grid=element_blank(),
panel.border=element_rect(fill="transparent"),
plot.title=element_text(hjust=0.5))+
geom_hline(yintercept=0,lty=2)+
geom_vline(xintercept=0,lty=2)+
geom_point(size=3,aes(col=LOCA))+
xlab(paste("PCA 3 (",round(pca$varprop[3]*100,2),"% )",sep=""))+
ylab(paste("PCA 4 (",round(pca$varprop[4]*100,2),"% )",sep=""))+
scale_colour_manual(name="Location",
values=c(color_med_atl[2],
color_med_atl[1],
color_med_atl[3],
color_med_atl[4]))
p2<-p
data_varpop=data.frame(PC=factor(paste("P",seq(1,10),sep=""),levels=paste("P",seq(1,10),sep="")),VAR=pca$varprop[1:10])
pp<-ggplot(data_varpop,aes(x=PC,y=VAR))+
geom_bar(stat='identity',fill="dodgerblue2",alpha=0.25)+
theme_classic()+
xlab("Principal Component")+
ylab("Variation explained (%)")
```
```{r}
subplot(ggplotly(p1)%>% layout(legend = list(orientation = "h", x = 0.2, y =-0.15)), ggplotly(p2)%>%hide_legend(), ggplotly(pp)%>%hide_legend(), titleX=T,titleY=T,margin=0.035,widths=c(0.375,0.425,0.2),which_layout=1) %>% partial_bundle()
```
### maf = 0.30
```{r}
pca=PCA_list$Prune_unfiltered$maf0.3[[1]]
data_pca=data.frame(INDIV=pca$sample.id,
PC1=pca$eigenvect[,1],
PC2=pca$eigenvect[,2],
PC3=pca$eigenvect[,3],
PC4=pca$eigenvect[,4],
LOCA=c(rep("Algarve",5),
rep("Bay of Biscay",4),
rep("Gulf of Lion",5),
rep("Costa Calida",0)))
color_med_atl=rev(brewer.pal(n=4,name="RdBu"))
p<-ggplot(data=data_pca,aes(x=PC1,y=PC2,label=INDIV))+
theme_minimal()+
theme(panel.grid=element_blank(),
panel.border=element_rect(fill="transparent"),
plot.title=element_text(hjust=0.5))+
geom_hline(yintercept=0,lty=2)+
geom_vline(xintercept=0,lty=2)+
geom_point(size=3,aes(col=LOCA))+
xlab(paste("PCA 1 (",round(pca$varprop[1]*100,2),"% )",sep=""))+
ylab(paste("PCA 2 (",round(pca$varprop[2]*100,2),"% )",sep=""))+
scale_colour_manual(name="Location",
values=c(color_med_atl[2],
color_med_atl[1],
color_med_atl[3],
color_med_atl[4]))
p1<-p
p<-ggplot(data=data_pca,aes(x=PC3,y=PC4,label=INDIV))+
theme_minimal()+
theme(panel.grid=element_blank(),
panel.border=element_rect(fill="transparent"),
plot.title=element_text(hjust=0.5))+
geom_hline(yintercept=0,lty=2)+
geom_vline(xintercept=0,lty=2)+
geom_point(size=3,aes(col=LOCA))+
xlab(paste("PCA 3 (",round(pca$varprop[3]*100,2),"% )",sep=""))+
ylab(paste("PCA 4 (",round(pca$varprop[4]*100,2),"% )",sep=""))+
scale_colour_manual(name="Location",
values=c(color_med_atl[2],
color_med_atl[1],
color_med_atl[3],
color_med_atl[4]))
p2<-p
data_varpop=data.frame(PC=factor(paste("P",seq(1,10),sep=""),levels=paste("P",seq(1,10),sep="")),VAR=pca$varprop[1:10])
pp<-ggplot(data_varpop,aes(x=PC,y=VAR))+
geom_bar(stat='identity',fill="dodgerblue2",alpha=0.25)+
theme_classic()+
xlab("Principal Component")+
ylab("Variation explained (%)")
```
```{r}
subplot(ggplotly(p1)%>% layout(legend = list(orientation = "h", x = 0.2, y =-0.15)), ggplotly(p2)%>%hide_legend(), ggplotly(pp)%>%hide_legend(), titleX=T,titleY=T,margin=0.035,widths=c(0.375,0.425,0.2),which_layout=1) %>% partial_bundle()
```
### maf = 0.35
```{r}
pca=PCA_list$Prune_unfiltered$maf0.35[[1]]
data_pca=data.frame(INDIV=pca$sample.id,
PC1=pca$eigenvect[,1],
PC2=pca$eigenvect[,2],
PC3=pca$eigenvect[,3],
PC4=pca$eigenvect[,4],
LOCA=c(rep("Algarve",5),
rep("Bay of Biscay",4),
rep("Gulf of Lion",5),
rep("Costa Calida",0)))
color_med_atl=rev(brewer.pal(n=4,name="RdBu"))
p<-ggplot(data=data_pca,aes(x=PC1,y=PC2,label=INDIV))+
theme_minimal()+
theme(panel.grid=element_blank(),
panel.border=element_rect(fill="transparent"),
plot.title=element_text(hjust=0.5))+
geom_hline(yintercept=0,lty=2)+
geom_vline(xintercept=0,lty=2)+
geom_point(size=3,aes(col=LOCA))+
xlab(paste("PCA 1 (",round(pca$varprop[1]*100,2),"% )",sep=""))+
ylab(paste("PCA 2 (",round(pca$varprop[2]*100,2),"% )",sep=""))+
scale_colour_manual(name="Location",
values=c(color_med_atl[2],
color_med_atl[1],
color_med_atl[3],
color_med_atl[4]))
p1<-p
p<-ggplot(data=data_pca,aes(x=PC3,y=PC4,label=INDIV))+
theme_minimal()+
theme(panel.grid=element_blank(),
panel.border=element_rect(fill="transparent"),
plot.title=element_text(hjust=0.5))+
geom_hline(yintercept=0,lty=2)+
geom_vline(xintercept=0,lty=2)+
geom_point(size=3,aes(col=LOCA))+
xlab(paste("PCA 3 (",round(pca$varprop[3]*100,2),"% )",sep=""))+
ylab(paste("PCA 4 (",round(pca$varprop[4]*100,2),"% )",sep=""))+
scale_colour_manual(name="Location",
values=c(color_med_atl[2],
color_med_atl[1],
color_med_atl[3],
color_med_atl[4]))
p2<-p
data_varpop=data.frame(PC=factor(paste("P",seq(1,10),sep=""),levels=paste("P",seq(1,10),sep="")),VAR=pca$varprop[1:10])
pp<-ggplot(data_varpop,aes(x=PC,y=VAR))+
geom_bar(stat='identity',fill="dodgerblue2",alpha=0.25)+
theme_classic()+
xlab("Principal Component")+
ylab("Variation explained (%)")
```
```{r}
subplot(ggplotly(p1)%>% layout(legend = list(orientation = "h", x = 0.2, y =-0.15)), ggplotly(p2)%>%hide_legend(), ggplotly(pp)%>%hide_legend(), titleX=T,titleY=T,margin=0.035,widths=c(0.375,0.425,0.2),which_layout=1) %>% partial_bundle()
```
### maf = 0.40
```{r}
pca=PCA_list$Prune_unfiltered$maf0.4[[1]]
data_pca=data.frame(INDIV=pca$sample.id,
PC1=pca$eigenvect[,1],
PC2=pca$eigenvect[,2],
PC3=pca$eigenvect[,3],
PC4=pca$eigenvect[,4],
LOCA=c(rep("Algarve",5),
rep("Bay of Biscay",4),
rep("Gulf of Lion",5),
rep("Costa Calida",0)))
color_med_atl=rev(brewer.pal(n=4,name="RdBu"))
p<-ggplot(data=data_pca,aes(x=PC1,y=PC2,label=INDIV))+
theme_minimal()+
theme(panel.grid=element_blank(),
panel.border=element_rect(fill="transparent"),
plot.title=element_text(hjust=0.5))+
geom_hline(yintercept=0,lty=2)+
geom_vline(xintercept=0,lty=2)+
geom_point(size=3,aes(col=LOCA))+
xlab(paste("PCA 1 (",round(pca$varprop[1]*100,2),"% )",sep=""))+
ylab(paste("PCA 2 (",round(pca$varprop[2]*100,2),"% )",sep=""))+
scale_colour_manual(name="Location",
values=c(color_med_atl[2],
color_med_atl[1],
color_med_atl[3],
color_med_atl[4]))
p1<-p
p<-ggplot(data=data_pca,aes(x=PC3,y=PC4,label=INDIV))+
theme_minimal()+
theme(panel.grid=element_blank(),
panel.border=element_rect(fill="transparent"),
plot.title=element_text(hjust=0.5))+
geom_hline(yintercept=0,lty=2)+
geom_vline(xintercept=0,lty=2)+
geom_point(size=3,aes(col=LOCA))+
xlab(paste("PCA 3 (",round(pca$varprop[3]*100,2),"% )",sep=""))+
ylab(paste("PCA 4 (",round(pca$varprop[4]*100,2),"% )",sep=""))+
scale_colour_manual(name="Location",
values=c(color_med_atl[2],
color_med_atl[1],
color_med_atl[3],
color_med_atl[4]))
p2<-p
data_varpop=data.frame(PC=factor(paste("P",seq(1,10),sep=""),levels=paste("P",seq(1,10),sep="")),VAR=pca$varprop[1:10])
pp<-ggplot(data_varpop,aes(x=PC,y=VAR))+
geom_bar(stat='identity',fill="dodgerblue2",alpha=0.25)+
theme_classic()+
xlab("Principal Component")+
ylab("Variation explained (%)")
```
```{r}
subplot(ggplotly(p1)%>% layout(legend = list(orientation = "h", x = 0.2, y =-0.15)), ggplotly(p2)%>%hide_legend(), ggplotly(pp)%>%hide_legend(), titleX=T,titleY=T,margin=0.035,widths=c(0.375,0.425,0.2),which_layout=1) %>% partial_bundle()
```
### maf = 0.45
```{r}
pca=PCA_list$Prune_unfiltered$maf0.45[[1]]
data_pca=data.frame(INDIV=pca$sample.id,
PC1=pca$eigenvect[,1],
PC2=pca$eigenvect[,2],
PC3=pca$eigenvect[,3],
PC4=pca$eigenvect[,4],
LOCA=c(rep("Algarve",5),
rep("Bay of Biscay",4),
rep("Gulf of Lion",5),
rep("Costa Calida",0)))
color_med_atl=rev(brewer.pal(n=4,name="RdBu"))
p<-ggplot(data=data_pca,aes(x=PC1,y=PC2,label=INDIV))+
theme_minimal()+
theme(panel.grid=element_blank(),
panel.border=element_rect(fill="transparent"),
plot.title=element_text(hjust=0.5))+
geom_hline(yintercept=0,lty=2)+
geom_vline(xintercept=0,lty=2)+
geom_point(size=3,aes(col=LOCA))+
xlab(paste("PCA 1 (",round(pca$varprop[1]*100,2),"% )",sep=""))+
ylab(paste("PCA 2 (",round(pca$varprop[2]*100,2),"% )",sep=""))+
scale_colour_manual(name="Location",
values=c(color_med_atl[2],
color_med_atl[1],
color_med_atl[3],
color_med_atl[4]))
p1<-p
p<-ggplot(data=data_pca,aes(x=PC3,y=PC4,label=INDIV))+
theme_minimal()+
theme(panel.grid=element_blank(),
panel.border=element_rect(fill="transparent"),
plot.title=element_text(hjust=0.5))+
geom_hline(yintercept=0,lty=2)+
geom_vline(xintercept=0,lty=2)+
geom_point(size=3,aes(col=LOCA))+
xlab(paste("PCA 3 (",round(pca$varprop[3]*100,2),"% )",sep=""))+
ylab(paste("PCA 4 (",round(pca$varprop[4]*100,2),"% )",sep=""))+
scale_colour_manual(name="Location",
values=c(color_med_atl[2],
color_med_atl[1],
color_med_atl[3],
color_med_atl[4]))
p2<-p
data_varpop=data.frame(PC=factor(paste("P",seq(1,10),sep=""),levels=paste("P",seq(1,10),sep="")),VAR=pca$varprop[1:10])
pp<-ggplot(data_varpop,aes(x=PC,y=VAR))+
geom_bar(stat='identity',fill="dodgerblue2",alpha=0.25)+
theme_classic()+
xlab("Principal Component")+
ylab("Variation explained (%)")
```
```{r}
subplot(ggplotly(p1)%>% layout(legend = list(orientation = "h", x = 0.2, y =-0.15)), ggplotly(p2)%>%hide_legend(), ggplotly(pp)%>%hide_legend(), titleX=T,titleY=T,margin=0.035,widths=c(0.375,0.425,0.2),which_layout=1) %>% partial_bundle()
```
### maf = 0.50
```{r}
pca=PCA_list$Prune_unfiltered$maf0.5[[1]]
data_pca=data.frame(INDIV=pca$sample.id,
PC1=pca$eigenvect[,1],
PC2=pca$eigenvect[,2],
PC3=pca$eigenvect[,3],
PC4=pca$eigenvect[,4],
LOCA=c(rep("Algarve",5),
rep("Bay of Biscay",4),
rep("Gulf of Lion",5),
rep("Costa Calida",0)))
color_med_atl=rev(brewer.pal(n=4,name="RdBu"))
p<-ggplot(data=data_pca,aes(x=PC1,y=PC2,label=INDIV))+
theme_minimal()+
theme(panel.grid=element_blank(),
panel.border=element_rect(fill="transparent"),
plot.title=element_text(hjust=0.5))+
geom_hline(yintercept=0,lty=2)+
geom_vline(xintercept=0,lty=2)+
geom_point(size=3,aes(col=LOCA))+
xlab(paste("PCA 1 (",round(pca$varprop[1]*100,2),"% )",sep=""))+
ylab(paste("PCA 2 (",round(pca$varprop[2]*100,2),"% )",sep=""))+
scale_colour_manual(name="Location",
values=c(color_med_atl[2],
color_med_atl[1],
color_med_atl[3],
color_med_atl[4]))
p1<-p
p<-ggplot(data=data_pca,aes(x=PC3,y=PC4,label=INDIV))+
theme_minimal()+
theme(panel.grid=element_blank(),
panel.border=element_rect(fill="transparent"),
plot.title=element_text(hjust=0.5))+
geom_hline(yintercept=0,lty=2)+
geom_vline(xintercept=0,lty=2)+
geom_point(size=3,aes(col=LOCA))+
xlab(paste("PCA 3 (",round(pca$varprop[3]*100,2),"% )",sep=""))+
ylab(paste("PCA 4 (",round(pca$varprop[4]*100,2),"% )",sep=""))+
scale_colour_manual(name="Location",
values=c(color_med_atl[2],
color_med_atl[1],
color_med_atl[3],
color_med_atl[4]))
p2<-p
data_varpop=data.frame(PC=factor(paste("P",seq(1,10),sep=""),levels=paste("P",seq(1,10),sep="")),VAR=pca$varprop[1:10])
pp<-ggplot(data_varpop,aes(x=PC,y=VAR))+
geom_bar(stat='identity',fill="dodgerblue2",alpha=0.25)+
theme_classic()+
xlab("Principal Component")+
ylab("Variation explained (%)")
```
```{r}
subplot(ggplotly(p1)%>% layout(legend = list(orientation = "h", x = 0.2, y =-0.15)), ggplotly(p2)%>%hide_legend(), ggplotly(pp)%>%hide_legend(), titleX=T,titleY=T,margin=0.035,widths=c(0.375,0.425,0.2),which_layout=1) %>% partial_bundle()
```
Coryphoblennius galerita {data-navmenu="Species"}
=======================================================================
```{r, include = FALSE}
load(file = paste(path,"/output/pca/Cgale_PCA_list.Rdata",sep=""))
```
Row {.tabset data-height=100}
-----------------------
<center>
<font size="6">**Coryphoblennius galerita**</font>
</center>
Row {.tabset data-height=50}
-----------------------
<center>
<font size="6">**All filtered SNPS**</font>
</center>
Row {.tabset data-height=600}
-----------------------
### maf = 0
```{r}
pca=PCA_list$All_filtered$maf0[[1]]
data_pca=data.frame(INDIV=pca$sample.id,
PC1=pca$eigenvect[,1],
PC2=pca$eigenvect[,2],
PC3=pca$eigenvect[,3],
PC4=pca$eigenvect[,4],
LOCA=c(rep("Algarve",5),
rep("Bay of Biscay",5),
rep("Gulf of Lion",5),
rep("Costa Calida",5)))
color_med_atl=rev(brewer.pal(n=4,name="RdBu"))
p<-ggplot(data=data_pca,aes(x=PC1,y=PC2,label=INDIV))+
theme_minimal()+
theme(panel.grid=element_blank(),
panel.border=element_rect(fill="transparent"),
plot.title=element_text(hjust=0.5))+
geom_hline(yintercept=0,lty=2)+
geom_vline(xintercept=0,lty=2)+
geom_point(size=3,aes(col=LOCA))+
xlab(paste("PCA 1 (",round(pca$varprop[1]*100,2),"% )",sep=""))+
ylab(paste("PCA 2 (",round(pca$varprop[2]*100,2),"% )",sep=""))+
scale_colour_manual(name="Location",
values=c(color_med_atl[2],
color_med_atl[1],
color_med_atl[3],
color_med_atl[4]))
p1<-p
p<-ggplot(data=data_pca,aes(x=PC3,y=PC4,label=INDIV))+
theme_minimal()+
theme(panel.grid=element_blank(),
panel.border=element_rect(fill="transparent"),
plot.title=element_text(hjust=0.5))+
geom_hline(yintercept=0,lty=2)+
geom_vline(xintercept=0,lty=2)+
geom_point(size=3,aes(col=LOCA))+
xlab(paste("PCA 3 (",round(pca$varprop[3]*100,2),"% )",sep=""))+
ylab(paste("PCA 4 (",round(pca$varprop[4]*100,2),"% )",sep=""))+
scale_colour_manual(name="Location",
values=c(color_med_atl[2],
color_med_atl[1],
color_med_atl[3],
color_med_atl[4]))
p2<-p
data_varpop=data.frame(PC=factor(paste("P",seq(1,10),sep=""),levels=paste("P",seq(1,10),sep="")),VAR=pca$varprop[1:10])
pp<-ggplot(data_varpop,aes(x=PC,y=VAR))+
geom_bar(stat='identity',fill="dodgerblue2",alpha=0.25)+
theme_classic()+
xlab("Principal Component")+
ylab("Variation explained (%)")
```
```{r}
subplot(ggplotly(p1)%>% layout(legend = list(orientation = "h", x = 0.2, y =-0.15)), ggplotly(p2)%>%hide_legend(), ggplotly(pp)%>%hide_legend(), titleX=T,titleY=T,margin=0.035,widths=c(0.375,0.425,0.2),which_layout=1) %>% partial_bundle()
```
### maf = 0.05
```{r}
pca=PCA_list$All_filtered$maf0.05[[1]]
data_pca=data.frame(INDIV=pca$sample.id,
PC1=pca$eigenvect[,1],
PC2=pca$eigenvect[,2],
PC3=pca$eigenvect[,3],
PC4=pca$eigenvect[,4],
LOCA=c(rep("Algarve",5),
rep("Bay of Biscay",5),
rep("Gulf of Lion",5),
rep("Costa Calida",5)))
color_med_atl=rev(brewer.pal(n=4,name="RdBu"))
p<-ggplot(data=data_pca,aes(x=PC1,y=PC2,label=INDIV))+
theme_minimal()+
theme(panel.grid=element_blank(),
panel.border=element_rect(fill="transparent"),
plot.title=element_text(hjust=0.5))+
geom_hline(yintercept=0,lty=2)+
geom_vline(xintercept=0,lty=2)+
geom_point(size=3,aes(col=LOCA))+
xlab(paste("PCA 1 (",round(pca$varprop[1]*100,2),"% )",sep=""))+
ylab(paste("PCA 2 (",round(pca$varprop[2]*100,2),"% )",sep=""))+
scale_colour_manual(name="Location",
values=c(color_med_atl[2],
color_med_atl[1],
color_med_atl[3],
color_med_atl[4]))
p1<-p
p<-ggplot(data=data_pca,aes(x=PC3,y=PC4,label=INDIV))+
theme_minimal()+
theme(panel.grid=element_blank(),
panel.border=element_rect(fill="transparent"),
plot.title=element_text(hjust=0.5))+
geom_hline(yintercept=0,lty=2)+
geom_vline(xintercept=0,lty=2)+
geom_point(size=3,aes(col=LOCA))+
xlab(paste("PCA 3 (",round(pca$varprop[3]*100,2),"% )",sep=""))+
ylab(paste("PCA 4 (",round(pca$varprop[4]*100,2),"% )",sep=""))+
scale_colour_manual(name="Location",
values=c(color_med_atl[2],
color_med_atl[1],
color_med_atl[3],
color_med_atl[4]))
p2<-p
data_varpop=data.frame(PC=factor(paste("P",seq(1,10),sep=""),levels=paste("P",seq(1,10),sep="")),VAR=pca$varprop[1:10])
pp<-ggplot(data_varpop,aes(x=PC,y=VAR))+
geom_bar(stat='identity',fill="dodgerblue2",alpha=0.25)+
theme_classic()+
xlab("Principal Component")+
ylab("Variation explained (%)")
```
```{r}
subplot(ggplotly(p1)%>% layout(legend = list(orientation = "h", x = 0.2, y =-0.15)), ggplotly(p2)%>%hide_legend(), ggplotly(pp)%>%hide_legend(), titleX=T,titleY=T,margin=0.035,widths=c(0.375,0.425,0.2),which_layout=1) %>% partial_bundle()
```
### maf = 0.1
```{r}
pca=PCA_list$All_filtered$maf0.1[[1]]
data_pca=data.frame(INDIV=pca$sample.id,
PC1=pca$eigenvect[,1],
PC2=pca$eigenvect[,2],
PC3=pca$eigenvect[,3],
PC4=pca$eigenvect[,4],
LOCA=c(rep("Algarve",5),
rep("Bay of Biscay",5),
rep("Gulf of Lion",5),
rep("Costa Calida",5)))
color_med_atl=rev(brewer.pal(n=4,name="RdBu"))
p<-ggplot(data=data_pca,aes(x=PC1,y=PC2,label=INDIV))+
theme_minimal()+
theme(panel.grid=element_blank(),
panel.border=element_rect(fill="transparent"),
plot.title=element_text(hjust=0.5))+
geom_hline(yintercept=0,lty=2)+
geom_vline(xintercept=0,lty=2)+
geom_point(size=3,aes(col=LOCA))+
xlab(paste("PCA 1 (",round(pca$varprop[1]*100,2),"% )",sep=""))+
ylab(paste("PCA 2 (",round(pca$varprop[2]*100,2),"% )",sep=""))+
scale_colour_manual(name="Location",
values=c(color_med_atl[2],
color_med_atl[1],
color_med_atl[3],
color_med_atl[4]))
p1<-p
p<-ggplot(data=data_pca,aes(x=PC3,y=PC4,label=INDIV))+
theme_minimal()+
theme(panel.grid=element_blank(),
panel.border=element_rect(fill="transparent"),
plot.title=element_text(hjust=0.5))+
geom_hline(yintercept=0,lty=2)+
geom_vline(xintercept=0,lty=2)+
geom_point(size=3,aes(col=LOCA))+
xlab(paste("PCA 3 (",round(pca$varprop[3]*100,2),"% )",sep=""))+
ylab(paste("PCA 4 (",round(pca$varprop[4]*100,2),"% )",sep=""))+
scale_colour_manual(name="Location",
values=c(color_med_atl[2],
color_med_atl[1],
color_med_atl[3],
color_med_atl[4]))
p2<-p
data_varpop=data.frame(PC=factor(paste("P",seq(1,10),sep=""),levels=paste("P",seq(1,10),sep="")),VAR=pca$varprop[1:10])
pp<-ggplot(data_varpop,aes(x=PC,y=VAR))+
geom_bar(stat='identity',fill="dodgerblue2",alpha=0.25)+
theme_classic()+
xlab("Principal Component")+
ylab("Variation explained (%)")
```
```{r}
subplot(ggplotly(p1)%>% layout(legend = list(orientation = "h", x = 0.2, y =-0.15)), ggplotly(p2)%>%hide_legend(), ggplotly(pp)%>%hide_legend(), titleX=T,titleY=T,margin=0.035,widths=c(0.375,0.425,0.2),which_layout=1) %>% partial_bundle()
```
### maf = 0.15
```{r}
pca=PCA_list$All_filtered$maf0.15[[1]]
data_pca=data.frame(INDIV=pca$sample.id,
PC1=pca$eigenvect[,1],
PC2=pca$eigenvect[,2],
PC3=pca$eigenvect[,3],
PC4=pca$eigenvect[,4],
LOCA=c(rep("Algarve",5),
rep("Bay of Biscay",5),
rep("Gulf of Lion",5),
rep("Costa Calida",5)))
color_med_atl=rev(brewer.pal(n=4,name="RdBu"))
p<-ggplot(data=data_pca,aes(x=PC1,y=PC2,label=INDIV))+
theme_minimal()+
theme(panel.grid=element_blank(),
panel.border=element_rect(fill="transparent"),
plot.title=element_text(hjust=0.5))+
geom_hline(yintercept=0,lty=2)+
geom_vline(xintercept=0,lty=2)+
geom_point(size=3,aes(col=LOCA))+
xlab(paste("PCA 1 (",round(pca$varprop[1]*100,2),"% )",sep=""))+
ylab(paste("PCA 2 (",round(pca$varprop[2]*100,2),"% )",sep=""))+
scale_colour_manual(name="Location",
values=c(color_med_atl[2],
color_med_atl[1],
color_med_atl[3],
color_med_atl[4]))
p1<-p
p<-ggplot(data=data_pca,aes(x=PC3,y=PC4,label=INDIV))+
theme_minimal()+
theme(panel.grid=element_blank(),
panel.border=element_rect(fill="transparent"),
plot.title=element_text(hjust=0.5))+
geom_hline(yintercept=0,lty=2)+
geom_vline(xintercept=0,lty=2)+
geom_point(size=3,aes(col=LOCA))+
xlab(paste("PCA 3 (",round(pca$varprop[3]*100,2),"% )",sep=""))+
ylab(paste("PCA 4 (",round(pca$varprop[4]*100,2),"% )",sep=""))+
scale_colour_manual(name="Location",
values=c(color_med_atl[2],
color_med_atl[1],
color_med_atl[3],
color_med_atl[4]))
p2<-p
data_varpop=data.frame(PC=factor(paste("P",seq(1,10),sep=""),levels=paste("P",seq(1,10),sep="")),VAR=pca$varprop[1:10])
pp<-ggplot(data_varpop,aes(x=PC,y=VAR))+
geom_bar(stat='identity',fill="dodgerblue2",alpha=0.25)+
theme_classic()+
xlab("Principal Component")+
ylab("Variation explained (%)")
```
```{r}
subplot(ggplotly(p1)%>% layout(legend = list(orientation = "h", x = 0.2, y =-0.15)), ggplotly(p2)%>%hide_legend(), ggplotly(pp)%>%hide_legend(), titleX=T,titleY=T,margin=0.035,widths=c(0.375,0.425,0.2),which_layout=1) %>% partial_bundle()
```
### maf = 0.20
```{r}
pca=PCA_list$All_filtered$maf0.2[[1]]
data_pca=data.frame(INDIV=pca$sample.id,
PC1=pca$eigenvect[,1],
PC2=pca$eigenvect[,2],
PC3=pca$eigenvect[,3],
PC4=pca$eigenvect[,4],
LOCA=c(rep("Algarve",5),
rep("Bay of Biscay",5),
rep("Gulf of Lion",5),
rep("Costa Calida",5)))
color_med_atl=rev(brewer.pal(n=4,name="RdBu"))
p<-ggplot(data=data_pca,aes(x=PC1,y=PC2,label=INDIV))+
theme_minimal()+
theme(panel.grid=element_blank(),
panel.border=element_rect(fill="transparent"),
plot.title=element_text(hjust=0.5))+
geom_hline(yintercept=0,lty=2)+
geom_vline(xintercept=0,lty=2)+
geom_point(size=3,aes(col=LOCA))+
xlab(paste("PCA 1 (",round(pca$varprop[1]*100,2),"% )",sep=""))+
ylab(paste("PCA 2 (",round(pca$varprop[2]*100,2),"% )",sep=""))+
scale_colour_manual(name="Location",
values=c(color_med_atl[2],
color_med_atl[1],
color_med_atl[3],
color_med_atl[4]))
p1<-p
p<-ggplot(data=data_pca,aes(x=PC3,y=PC4,label=INDIV))+
theme_minimal()+
theme(panel.grid=element_blank(),
panel.border=element_rect(fill="transparent"),
plot.title=element_text(hjust=0.5))+
geom_hline(yintercept=0,lty=2)+
geom_vline(xintercept=0,lty=2)+
geom_point(size=3,aes(col=LOCA))+
xlab(paste("PCA 3 (",round(pca$varprop[3]*100,2),"% )",sep=""))+
ylab(paste("PCA 4 (",round(pca$varprop[4]*100,2),"% )",sep=""))+
scale_colour_manual(name="Location",
values=c(color_med_atl[2],
color_med_atl[1],
color_med_atl[3],
color_med_atl[4]))
p2<-p
data_varpop=data.frame(PC=factor(paste("P",seq(1,10),sep=""),levels=paste("P",seq(1,10),sep="")),VAR=pca$varprop[1:10])
pp<-ggplot(data_varpop,aes(x=PC,y=VAR))+
geom_bar(stat='identity',fill="dodgerblue2",alpha=0.25)+
theme_classic()+
xlab("Principal Component")+
ylab("Variation explained (%)")
```
```{r}
subplot(ggplotly(p1)%>% layout(legend = list(orientation = "h", x = 0.2, y =-0.15)), ggplotly(p2)%>%hide_legend(), ggplotly(pp)%>%hide_legend(), titleX=T,titleY=T,margin=0.035,widths=c(0.375,0.425,0.2),which_layout=1) %>% partial_bundle()
```
### maf = 0.25
```{r}
pca=PCA_list$All_filtered$maf0.25[[1]]
data_pca=data.frame(INDIV=pca$sample.id,
PC1=pca$eigenvect[,1],
PC2=pca$eigenvect[,2],
PC3=pca$eigenvect[,3],
PC4=pca$eigenvect[,4],
LOCA=c(rep("Algarve",5),
rep("Bay of Biscay",5),
rep("Gulf of Lion",5),
rep("Costa Calida",5)))
color_med_atl=rev(brewer.pal(n=4,name="RdBu"))
p<-ggplot(data=data_pca,aes(x=PC1,y=PC2,label=INDIV))+
theme_minimal()+
theme(panel.grid=element_blank(),
panel.border=element_rect(fill="transparent"),
plot.title=element_text(hjust=0.5))+
geom_hline(yintercept=0,lty=2)+
geom_vline(xintercept=0,lty=2)+
geom_point(size=3,aes(col=LOCA))+
xlab(paste("PCA 1 (",round(pca$varprop[1]*100,2),"% )",sep=""))+
ylab(paste("PCA 2 (",round(pca$varprop[2]*100,2),"% )",sep=""))+
scale_colour_manual(name="Location",
values=c(color_med_atl[2],
color_med_atl[1],
color_med_atl[3],
color_med_atl[4]))
p1<-p
p<-ggplot(data=data_pca,aes(x=PC3,y=PC4,label=INDIV))+
theme_minimal()+
theme(panel.grid=element_blank(),
panel.border=element_rect(fill="transparent"),
plot.title=element_text(hjust=0.5))+
geom_hline(yintercept=0,lty=2)+
geom_vline(xintercept=0,lty=2)+
geom_point(size=3,aes(col=LOCA))+
xlab(paste("PCA 3 (",round(pca$varprop[3]*100,2),"% )",sep=""))+
ylab(paste("PCA 4 (",round(pca$varprop[4]*100,2),"% )",sep=""))+
scale_colour_manual(name="Location",
values=c(color_med_atl[2],
color_med_atl[1],
color_med_atl[3],
color_med_atl[4]))
p2<-p
data_varpop=data.frame(PC=factor(paste("P",seq(1,10),sep=""),levels=paste("P",seq(1,10),sep="")),VAR=pca$varprop[1:10])
pp<-ggplot(data_varpop,aes(x=PC,y=VAR))+
geom_bar(stat='identity',fill="dodgerblue2",alpha=0.25)+
theme_classic()+
xlab("Principal Component")+
ylab("Variation explained (%)")
```
```{r}
subplot(ggplotly(p1)%>% layout(legend = list(orientation = "h", x = 0.2, y =-0.15)), ggplotly(p2)%>%hide_legend(), ggplotly(pp)%>%hide_legend(), titleX=T,titleY=T,margin=0.035,widths=c(0.375,0.425,0.2),which_layout=1) %>% partial_bundle()
```
### maf = 0.30
```{r}
pca=PCA_list$All_filtered$maf0.3[[1]]
data_pca=data.frame(INDIV=pca$sample.id,
PC1=pca$eigenvect[,1],
PC2=pca$eigenvect[,2],
PC3=pca$eigenvect[,3],
PC4=pca$eigenvect[,4],
LOCA=c(rep("Algarve",5),
rep("Bay of Biscay",5),
rep("Gulf of Lion",5),
rep("Costa Calida",5)))
color_med_atl=rev(brewer.pal(n=4,name="RdBu"))
p<-ggplot(data=data_pca,aes(x=PC1,y=PC2,label=INDIV))+
theme_minimal()+
theme(panel.grid=element_blank(),
panel.border=element_rect(fill="transparent"),
plot.title=element_text(hjust=0.5))+
geom_hline(yintercept=0,lty=2)+
geom_vline(xintercept=0,lty=2)+
geom_point(size=3,aes(col=LOCA))+
xlab(paste("PCA 1 (",round(pca$varprop[1]*100,2),"% )",sep=""))+
ylab(paste("PCA 2 (",round(pca$varprop[2]*100,2),"% )",sep=""))+
scale_colour_manual(name="Location",
values=c(color_med_atl[2],
color_med_atl[1],
color_med_atl[3],
color_med_atl[4]))
p1<-p
p<-ggplot(data=data_pca,aes(x=PC3,y=PC4,label=INDIV))+
theme_minimal()+
theme(panel.grid=element_blank(),
panel.border=element_rect(fill="transparent"),
plot.title=element_text(hjust=0.5))+
geom_hline(yintercept=0,lty=2)+
geom_vline(xintercept=0,lty=2)+
geom_point(size=3,aes(col=LOCA))+
xlab(paste("PCA 3 (",round(pca$varprop[3]*100,2),"% )",sep=""))+
ylab(paste("PCA 4 (",round(pca$varprop[4]*100,2),"% )",sep=""))+
scale_colour_manual(name="Location",
values=c(color_med_atl[2],
color_med_atl[1],
color_med_atl[3],
color_med_atl[4]))
p2<-p
data_varpop=data.frame(PC=factor(paste("P",seq(1,10),sep=""),levels=paste("P",seq(1,10),sep="")),VAR=pca$varprop[1:10])
pp<-ggplot(data_varpop,aes(x=PC,y=VAR))+
geom_bar(stat='identity',fill="dodgerblue2",alpha=0.25)+
theme_classic()+
xlab("Principal Component")+
ylab("Variation explained (%)")
```
```{r}
subplot(ggplotly(p1)%>% layout(legend = list(orientation = "h", x = 0.2, y =-0.15)), ggplotly(p2)%>%hide_legend(), ggplotly(pp)%>%hide_legend(), titleX=T,titleY=T,margin=0.035,widths=c(0.375,0.425,0.2),which_layout=1) %>% partial_bundle()
```
### maf = 0.35
```{r}
pca=PCA_list$All_filtered$maf0.35[[1]]
data_pca=data.frame(INDIV=pca$sample.id,
PC1=pca$eigenvect[,1],
PC2=pca$eigenvect[,2],
PC3=pca$eigenvect[,3],
PC4=pca$eigenvect[,4],
LOCA=c(rep("Algarve",5),
rep("Bay of Biscay",5),
rep("Gulf of Lion",5),
rep("Costa Calida",5)))
color_med_atl=rev(brewer.pal(n=4,name="RdBu"))
p<-ggplot(data=data_pca,aes(x=PC1,y=PC2,label=INDIV))+
theme_minimal()+
theme(panel.grid=element_blank(),
panel.border=element_rect(fill="transparent"),
plot.title=element_text(hjust=0.5))+
geom_hline(yintercept=0,lty=2)+
geom_vline(xintercept=0,lty=2)+
geom_point(size=3,aes(col=LOCA))+
xlab(paste("PCA 1 (",round(pca$varprop[1]*100,2),"% )",sep=""))+
ylab(paste("PCA 2 (",round(pca$varprop[2]*100,2),"% )",sep=""))+
scale_colour_manual(name="Location",
values=c(color_med_atl[2],
color_med_atl[1],
color_med_atl[3],
color_med_atl[4]))
p1<-p
p<-ggplot(data=data_pca,aes(x=PC3,y=PC4,label=INDIV))+
theme_minimal()+
theme(panel.grid=element_blank(),
panel.border=element_rect(fill="transparent"),
plot.title=element_text(hjust=0.5))+
geom_hline(yintercept=0,lty=2)+
geom_vline(xintercept=0,lty=2)+
geom_point(size=3,aes(col=LOCA))+
xlab(paste("PCA 3 (",round(pca$varprop[3]*100,2),"% )",sep=""))+
ylab(paste("PCA 4 (",round(pca$varprop[4]*100,2),"% )",sep=""))+
scale_colour_manual(name="Location",
values=c(color_med_atl[2],
color_med_atl[1],
color_med_atl[3],
color_med_atl[4]))
p2<-p
data_varpop=data.frame(PC=factor(paste("P",seq(1,10),sep=""),levels=paste("P",seq(1,10),sep="")),VAR=pca$varprop[1:10])
pp<-ggplot(data_varpop,aes(x=PC,y=VAR))+
geom_bar(stat='identity',fill="dodgerblue2",alpha=0.25)+
theme_classic()+
xlab("Principal Component")+
ylab("Variation explained (%)")
```
```{r}
subplot(ggplotly(p1)%>% layout(legend = list(orientation = "h", x = 0.2, y =-0.15)), ggplotly(p2)%>%hide_legend(), ggplotly(pp)%>%hide_legend(), titleX=T,titleY=T,margin=0.035,widths=c(0.375,0.425,0.2),which_layout=1) %>% partial_bundle()
```
### maf = 0.40
```{r}
pca=PCA_list$All_filtered$maf0.4[[1]]
data_pca=data.frame(INDIV=pca$sample.id,
PC1=pca$eigenvect[,1],
PC2=pca$eigenvect[,2],
PC3=pca$eigenvect[,3],
PC4=pca$eigenvect[,4],
LOCA=c(rep("Algarve",5),
rep("Bay of Biscay",5),
rep("Gulf of Lion",5),
rep("Costa Calida",5)))
color_med_atl=rev(brewer.pal(n=4,name="RdBu"))
p<-ggplot(data=data_pca,aes(x=PC1,y=PC2,label=INDIV))+
theme_minimal()+
theme(panel.grid=element_blank(),
panel.border=element_rect(fill="transparent"),
plot.title=element_text(hjust=0.5))+
geom_hline(yintercept=0,lty=2)+
geom_vline(xintercept=0,lty=2)+
geom_point(size=3,aes(col=LOCA))+
xlab(paste("PCA 1 (",round(pca$varprop[1]*100,2),"% )",sep=""))+
ylab(paste("PCA 2 (",round(pca$varprop[2]*100,2),"% )",sep=""))+
scale_colour_manual(name="Location",
values=c(color_med_atl[2],
color_med_atl[1],
color_med_atl[3],
color_med_atl[4]))
p1<-p
p<-ggplot(data=data_pca,aes(x=PC3,y=PC4,label=INDIV))+
theme_minimal()+
theme(panel.grid=element_blank(),
panel.border=element_rect(fill="transparent"),
plot.title=element_text(hjust=0.5))+
geom_hline(yintercept=0,lty=2)+
geom_vline(xintercept=0,lty=2)+
geom_point(size=3,aes(col=LOCA))+
xlab(paste("PCA 3 (",round(pca$varprop[3]*100,2),"% )",sep=""))+
ylab(paste("PCA 4 (",round(pca$varprop[4]*100,2),"% )",sep=""))+
scale_colour_manual(name="Location",
values=c(color_med_atl[2],
color_med_atl[1],
color_med_atl[3],
color_med_atl[4]))
p2<-p
data_varpop=data.frame(PC=factor(paste("P",seq(1,10),sep=""),levels=paste("P",seq(1,10),sep="")),VAR=pca$varprop[1:10])
pp<-ggplot(data_varpop,aes(x=PC,y=VAR))+
geom_bar(stat='identity',fill="dodgerblue2",alpha=0.25)+
theme_classic()+
xlab("Principal Component")+
ylab("Variation explained (%)")
```
```{r}
subplot(ggplotly(p1)%>% layout(legend = list(orientation = "h", x = 0.2, y =-0.15)), ggplotly(p2)%>%hide_legend(), ggplotly(pp)%>%hide_legend(), titleX=T,titleY=T,margin=0.035,widths=c(0.375,0.425,0.2),which_layout=1) %>% partial_bundle()
```
### maf = 0.45
```{r}
pca=PCA_list$All_filtered$maf0.45[[1]]
data_pca=data.frame(INDIV=pca$sample.id,
PC1=pca$eigenvect[,1],
PC2=pca$eigenvect[,2],
PC3=pca$eigenvect[,3],
PC4=pca$eigenvect[,4],
LOCA=c(rep("Algarve",5),
rep("Bay of Biscay",5),
rep("Gulf of Lion",5),
rep("Costa Calida",5)))
color_med_atl=rev(brewer.pal(n=4,name="RdBu"))
p<-ggplot(data=data_pca,aes(x=PC1,y=PC2,label=INDIV))+
theme_minimal()+
theme(panel.grid=element_blank(),
panel.border=element_rect(fill="transparent"),
plot.title=element_text(hjust=0.5))+
geom_hline(yintercept=0,lty=2)+
geom_vline(xintercept=0,lty=2)+
geom_point(size=3,aes(col=LOCA))+
xlab(paste("PCA 1 (",round(pca$varprop[1]*100,2),"% )",sep=""))+
ylab(paste("PCA 2 (",round(pca$varprop[2]*100,2),"% )",sep=""))+
scale_colour_manual(name="Location",
values=c(color_med_atl[2],
color_med_atl[1],
color_med_atl[3],
color_med_atl[4]))
p1<-p
p<-ggplot(data=data_pca,aes(x=PC3,y=PC4,label=INDIV))+
theme_minimal()+
theme(panel.grid=element_blank(),
panel.border=element_rect(fill="transparent"),
plot.title=element_text(hjust=0.5))+
geom_hline(yintercept=0,lty=2)+
geom_vline(xintercept=0,lty=2)+
geom_point(size=3,aes(col=LOCA))+
xlab(paste("PCA 3 (",round(pca$varprop[3]*100,2),"% )",sep=""))+
ylab(paste("PCA 4 (",round(pca$varprop[4]*100,2),"% )",sep=""))+
scale_colour_manual(name="Location",
values=c(color_med_atl[2],
color_med_atl[1],
color_med_atl[3],
color_med_atl[4]))
p2<-p
data_varpop=data.frame(PC=factor(paste("P",seq(1,10),sep=""),levels=paste("P",seq(1,10),sep="")),VAR=pca$varprop[1:10])
pp<-ggplot(data_varpop,aes(x=PC,y=VAR))+
geom_bar(stat='identity',fill="dodgerblue2",alpha=0.25)+
theme_classic()+
xlab("Principal Component")+
ylab("Variation explained (%)")
```
```{r}
subplot(ggplotly(p1)%>% layout(legend = list(orientation = "h", x = 0.2, y =-0.15)), ggplotly(p2)%>%hide_legend(), ggplotly(pp)%>%hide_legend(), titleX=T,titleY=T,margin=0.035,widths=c(0.375,0.425,0.2),which_layout=1) %>% partial_bundle()
```
### maf = 0.50
```{r}
pca=PCA_list$All_filtered$maf0.5[[1]]
data_pca=data.frame(INDIV=pca$sample.id,
PC1=pca$eigenvect[,1],
PC2=pca$eigenvect[,2],
PC3=pca$eigenvect[,3],
PC4=pca$eigenvect[,4],
LOCA=c(rep("Algarve",5),
rep("Bay of Biscay",5),
rep("Gulf of Lion",5),
rep("Costa Calida",5)))
color_med_atl=rev(brewer.pal(n=4,name="RdBu"))
p<-ggplot(data=data_pca,aes(x=PC1,y=PC2,label=INDIV))+
theme_minimal()+
theme(panel.grid=element_blank(),
panel.border=element_rect(fill="transparent"),
plot.title=element_text(hjust=0.5))+
geom_hline(yintercept=0,lty=2)+
geom_vline(xintercept=0,lty=2)+
geom_point(size=3,aes(col=LOCA))+
xlab(paste("PCA 1 (",round(pca$varprop[1]*100,2),"% )",sep=""))+
ylab(paste("PCA 2 (",round(pca$varprop[2]*100,2),"% )",sep=""))+
scale_colour_manual(name="Location",
values=c(color_med_atl[2],
color_med_atl[1],
color_med_atl[3],
color_med_atl[4]))
p1<-p
p<-ggplot(data=data_pca,aes(x=PC3,y=PC4,label=INDIV))+
theme_minimal()+
theme(panel.grid=element_blank(),
panel.border=element_rect(fill="transparent"),
plot.title=element_text(hjust=0.5))+
geom_hline(yintercept=0,lty=2)+
geom_vline(xintercept=0,lty=2)+
geom_point(size=3,aes(col=LOCA))+
xlab(paste("PCA 3 (",round(pca$varprop[3]*100,2),"% )",sep=""))+
ylab(paste("PCA 4 (",round(pca$varprop[4]*100,2),"% )",sep=""))+
scale_colour_manual(name="Location",
values=c(color_med_atl[2],
color_med_atl[1],
color_med_atl[3],
color_med_atl[4]))
p2<-p
data_varpop=data.frame(PC=factor(paste("P",seq(1,10),sep=""),levels=paste("P",seq(1,10),sep="")),VAR=pca$varprop[1:10])
pp<-ggplot(data_varpop,aes(x=PC,y=VAR))+
geom_bar(stat='identity',fill="dodgerblue2",alpha=0.25)+
theme_classic()+
xlab("Principal Component")+
ylab("Variation explained (%)")
```
```{r}
subplot(ggplotly(p1)%>% layout(legend = list(orientation = "h", x = 0.2, y =-0.15)), ggplotly(p2)%>%hide_legend(), ggplotly(pp)%>%hide_legend(), titleX=T,titleY=T,margin=0.035,widths=c(0.375,0.425,0.2),which_layout=1) %>% partial_bundle()
```
Row {.tabset data-height=50}
-----------------------
<center>
<font size="6">**Pruned filtered SNPS**</font>
</center>
Row {.tabset data-height=600}
-----------------------
### maf = 0
```{r}
pca=PCA_list$Prune_filtered$maf0[[1]]
data_pca=data.frame(INDIV=pca$sample.id,
PC1=pca$eigenvect[,1],
PC2=pca$eigenvect[,2],
PC3=pca$eigenvect[,3],
PC4=pca$eigenvect[,4],
LOCA=c(rep("Algarve",5),
rep("Bay of Biscay",5),
rep("Gulf of Lion",5),
rep("Costa Calida",5)))
color_med_atl=rev(brewer.pal(n=4,name="RdBu"))
p<-ggplot(data=data_pca,aes(x=PC1,y=PC2,label=INDIV))+
theme_minimal()+
theme(panel.grid=element_blank(),
panel.border=element_rect(fill="transparent"),
plot.title=element_text(hjust=0.5))+
geom_hline(yintercept=0,lty=2)+
geom_vline(xintercept=0,lty=2)+
geom_point(size=3,aes(col=LOCA))+
xlab(paste("PCA 1 (",round(pca$varprop[1]*100,2),"% )",sep=""))+
ylab(paste("PCA 2 (",round(pca$varprop[2]*100,2),"% )",sep=""))+
scale_colour_manual(name="Location",
values=c(color_med_atl[2],
color_med_atl[1],
color_med_atl[3],
color_med_atl[4]))
p1<-p
p<-ggplot(data=data_pca,aes(x=PC3,y=PC4,label=INDIV))+
theme_minimal()+
theme(panel.grid=element_blank(),
panel.border=element_rect(fill="transparent"),
plot.title=element_text(hjust=0.5))+
geom_hline(yintercept=0,lty=2)+
geom_vline(xintercept=0,lty=2)+
geom_point(size=3,aes(col=LOCA))+
xlab(paste("PCA 3 (",round(pca$varprop[3]*100,2),"% )",sep=""))+
ylab(paste("PCA 4 (",round(pca$varprop[4]*100,2),"% )",sep=""))+
scale_colour_manual(name="Location",
values=c(color_med_atl[2],
color_med_atl[1],
color_med_atl[3],
color_med_atl[4]))
p2<-p
data_varpop=data.frame(PC=factor(paste("P",seq(1,10),sep=""),levels=paste("P",seq(1,10),sep="")),VAR=pca$varprop[1:10])
pp<-ggplot(data_varpop,aes(x=PC,y=VAR))+
geom_bar(stat='identity',fill="dodgerblue2",alpha=0.25)+
theme_classic()+
xlab("Principal Component")+
ylab("Variation explained (%)")
```
```{r}
subplot(ggplotly(p1)%>% layout(legend = list(orientation = "h", x = 0.2, y =-0.15)), ggplotly(p2)%>%hide_legend(), ggplotly(pp)%>%hide_legend(), titleX=T,titleY=T,margin=0.035,widths=c(0.375,0.425,0.2),which_layout=1) %>% partial_bundle()
```
### maf = 0.05
```{r}
pca=PCA_list$Prune_filtered$maf0.05[[1]]
data_pca=data.frame(INDIV=pca$sample.id,
PC1=pca$eigenvect[,1],
PC2=pca$eigenvect[,2],
PC3=pca$eigenvect[,3],
PC4=pca$eigenvect[,4],
LOCA=c(rep("Algarve",5),
rep("Bay of Biscay",5),
rep("Gulf of Lion",5),
rep("Costa Calida",5)))
color_med_atl=rev(brewer.pal(n=4,name="RdBu"))
p<-ggplot(data=data_pca,aes(x=PC1,y=PC2,label=INDIV))+
theme_minimal()+
theme(panel.grid=element_blank(),
panel.border=element_rect(fill="transparent"),
plot.title=element_text(hjust=0.5))+
geom_hline(yintercept=0,lty=2)+
geom_vline(xintercept=0,lty=2)+
geom_point(size=3,aes(col=LOCA))+
xlab(paste("PCA 1 (",round(pca$varprop[1]*100,2),"% )",sep=""))+
ylab(paste("PCA 2 (",round(pca$varprop[2]*100,2),"% )",sep=""))+
scale_colour_manual(name="Location",
values=c(color_med_atl[2],
color_med_atl[1],
color_med_atl[3],
color_med_atl[4]))
p1<-p
p<-ggplot(data=data_pca,aes(x=PC3,y=PC4,label=INDIV))+
theme_minimal()+
theme(panel.grid=element_blank(),
panel.border=element_rect(fill="transparent"),
plot.title=element_text(hjust=0.5))+
geom_hline(yintercept=0,lty=2)+
geom_vline(xintercept=0,lty=2)+
geom_point(size=3,aes(col=LOCA))+
xlab(paste("PCA 3 (",round(pca$varprop[3]*100,2),"% )",sep=""))+
ylab(paste("PCA 4 (",round(pca$varprop[4]*100,2),"% )",sep=""))+
scale_colour_manual(name="Location",
values=c(color_med_atl[2],
color_med_atl[1],
color_med_atl[3],
color_med_atl[4]))
p2<-p
data_varpop=data.frame(PC=factor(paste("P",seq(1,10),sep=""),levels=paste("P",seq(1,10),sep="")),VAR=pca$varprop[1:10])
pp<-ggplot(data_varpop,aes(x=PC,y=VAR))+
geom_bar(stat='identity',fill="dodgerblue2",alpha=0.25)+
theme_classic()+
xlab("Principal Component")+
ylab("Variation explained (%)")
```
```{r}
subplot(ggplotly(p1)%>% layout(legend = list(orientation = "h", x = 0.2, y =-0.15)), ggplotly(p2)%>%hide_legend(), ggplotly(pp)%>%hide_legend(), titleX=T,titleY=T,margin=0.035,widths=c(0.375,0.425,0.2),which_layout=1) %>% partial_bundle()
```
### maf = 0.1
```{r}
pca=PCA_list$Prune_filtered$maf0.1[[1]]
data_pca=data.frame(INDIV=pca$sample.id,
PC1=pca$eigenvect[,1],
PC2=pca$eigenvect[,2],
PC3=pca$eigenvect[,3],
PC4=pca$eigenvect[,4],
LOCA=c(rep("Algarve",5),
rep("Bay of Biscay",5),
rep("Gulf of Lion",5),
rep("Costa Calida",5)))
color_med_atl=rev(brewer.pal(n=4,name="RdBu"))
p<-ggplot(data=data_pca,aes(x=PC1,y=PC2,label=INDIV))+
theme_minimal()+
theme(panel.grid=element_blank(),
panel.border=element_rect(fill="transparent"),
plot.title=element_text(hjust=0.5))+
geom_hline(yintercept=0,lty=2)+
geom_vline(xintercept=0,lty=2)+
geom_point(size=3,aes(col=LOCA))+
xlab(paste("PCA 1 (",round(pca$varprop[1]*100,2),"% )",sep=""))+
ylab(paste("PCA 2 (",round(pca$varprop[2]*100,2),"% )",sep=""))+
scale_colour_manual(name="Location",
values=c(color_med_atl[2],
color_med_atl[1],
color_med_atl[3],
color_med_atl[4]))
p1<-p
p<-ggplot(data=data_pca,aes(x=PC3,y=PC4,label=INDIV))+
theme_minimal()+
theme(panel.grid=element_blank(),
panel.border=element_rect(fill="transparent"),
plot.title=element_text(hjust=0.5))+
geom_hline(yintercept=0,lty=2)+
geom_vline(xintercept=0,lty=2)+
geom_point(size=3,aes(col=LOCA))+
xlab(paste("PCA 3 (",round(pca$varprop[3]*100,2),"% )",sep=""))+
ylab(paste("PCA 4 (",round(pca$varprop[4]*100,2),"% )",sep=""))+
scale_colour_manual(name="Location",
values=c(color_med_atl[2],
color_med_atl[1],
color_med_atl[3],
color_med_atl[4]))
p2<-p
data_varpop=data.frame(PC=factor(paste("P",seq(1,10),sep=""),levels=paste("P",seq(1,10),sep="")),VAR=pca$varprop[1:10])
pp<-ggplot(data_varpop,aes(x=PC,y=VAR))+
geom_bar(stat='identity',fill="dodgerblue2",alpha=0.25)+
theme_classic()+
xlab("Principal Component")+
ylab("Variation explained (%)")
```
```{r}
subplot(ggplotly(p1)%>% layout(legend = list(orientation = "h", x = 0.2, y =-0.15)), ggplotly(p2)%>%hide_legend(), ggplotly(pp)%>%hide_legend(), titleX=T,titleY=T,margin=0.035,widths=c(0.375,0.425,0.2),which_layout=1) %>% partial_bundle()
```
### maf = 0.15
```{r}
pca=PCA_list$Prune_filtered$maf0.15[[1]]
data_pca=data.frame(INDIV=pca$sample.id,
PC1=pca$eigenvect[,1],
PC2=pca$eigenvect[,2],
PC3=pca$eigenvect[,3],
PC4=pca$eigenvect[,4],
LOCA=c(rep("Algarve",5),
rep("Bay of Biscay",5),
rep("Gulf of Lion",5),
rep("Costa Calida",5)))
color_med_atl=rev(brewer.pal(n=4,name="RdBu"))
p<-ggplot(data=data_pca,aes(x=PC1,y=PC2,label=INDIV))+
theme_minimal()+
theme(panel.grid=element_blank(),
panel.border=element_rect(fill="transparent"),
plot.title=element_text(hjust=0.5))+
geom_hline(yintercept=0,lty=2)+
geom_vline(xintercept=0,lty=2)+
geom_point(size=3,aes(col=LOCA))+
xlab(paste("PCA 1 (",round(pca$varprop[1]*100,2),"% )",sep=""))+
ylab(paste("PCA 2 (",round(pca$varprop[2]*100,2),"% )",sep=""))+
scale_colour_manual(name="Location",
values=c(color_med_atl[2],
color_med_atl[1],
color_med_atl[3],
color_med_atl[4]))
p1<-p
p<-ggplot(data=data_pca,aes(x=PC3,y=PC4,label=INDIV))+
theme_minimal()+
theme(panel.grid=element_blank(),
panel.border=element_rect(fill="transparent"),
plot.title=element_text(hjust=0.5))+
geom_hline(yintercept=0,lty=2)+
geom_vline(xintercept=0,lty=2)+
geom_point(size=3,aes(col=LOCA))+
xlab(paste("PCA 3 (",round(pca$varprop[3]*100,2),"% )",sep=""))+
ylab(paste("PCA 4 (",round(pca$varprop[4]*100,2),"% )",sep=""))+
scale_colour_manual(name="Location",
values=c(color_med_atl[2],
color_med_atl[1],
color_med_atl[3],
color_med_atl[4]))
p2<-p
data_varpop=data.frame(PC=factor(paste("P",seq(1,10),sep=""),levels=paste("P",seq(1,10),sep="")),VAR=pca$varprop[1:10])
pp<-ggplot(data_varpop,aes(x=PC,y=VAR))+
geom_bar(stat='identity',fill="dodgerblue2",alpha=0.25)+
theme_classic()+
xlab("Principal Component")+
ylab("Variation explained (%)")
```
```{r}
subplot(ggplotly(p1)%>% layout(legend = list(orientation = "h", x = 0.2, y =-0.15)), ggplotly(p2)%>%hide_legend(), ggplotly(pp)%>%hide_legend(), titleX=T,titleY=T,margin=0.035,widths=c(0.375,0.425,0.2),which_layout=1) %>% partial_bundle()
```
### maf = 0.20
```{r}
pca=PCA_list$Prune_filtered$maf0.2[[1]]
data_pca=data.frame(INDIV=pca$sample.id,
PC1=pca$eigenvect[,1],
PC2=pca$eigenvect[,2],
PC3=pca$eigenvect[,3],
PC4=pca$eigenvect[,4],
LOCA=c(rep("Algarve",5),
rep("Bay of Biscay",5),
rep("Gulf of Lion",5),
rep("Costa Calida",5)))
color_med_atl=rev(brewer.pal(n=4,name="RdBu"))
p<-ggplot(data=data_pca,aes(x=PC1,y=PC2,label=INDIV))+
theme_minimal()+
theme(panel.grid=element_blank(),
panel.border=element_rect(fill="transparent"),
plot.title=element_text(hjust=0.5))+
geom_hline(yintercept=0,lty=2)+
geom_vline(xintercept=0,lty=2)+
geom_point(size=3,aes(col=LOCA))+
xlab(paste("PCA 1 (",round(pca$varprop[1]*100,2),"% )",sep=""))+
ylab(paste("PCA 2 (",round(pca$varprop[2]*100,2),"% )",sep=""))+
scale_colour_manual(name="Location",
values=c(color_med_atl[2],
color_med_atl[1],
color_med_atl[3],
color_med_atl[4]))
p1<-p
p<-ggplot(data=data_pca,aes(x=PC3,y=PC4,label=INDIV))+
theme_minimal()+
theme(panel.grid=element_blank(),
panel.border=element_rect(fill="transparent"),
plot.title=element_text(hjust=0.5))+
geom_hline(yintercept=0,lty=2)+
geom_vline(xintercept=0,lty=2)+
geom_point(size=3,aes(col=LOCA))+
xlab(paste("PCA 3 (",round(pca$varprop[3]*100,2),"% )",sep=""))+
ylab(paste("PCA 4 (",round(pca$varprop[4]*100,2),"% )",sep=""))+
scale_colour_manual(name="Location",
values=c(color_med_atl[2],
color_med_atl[1],
color_med_atl[3],
color_med_atl[4]))
p2<-p
data_varpop=data.frame(PC=factor(paste("P",seq(1,10),sep=""),levels=paste("P",seq(1,10),sep="")),VAR=pca$varprop[1:10])
pp<-ggplot(data_varpop,aes(x=PC,y=VAR))+
geom_bar(stat='identity',fill="dodgerblue2",alpha=0.25)+
theme_classic()+
xlab("Principal Component")+
ylab("Variation explained (%)")
```
```{r}
subplot(ggplotly(p1)%>% layout(legend = list(orientation = "h", x = 0.2, y =-0.15)), ggplotly(p2)%>%hide_legend(), ggplotly(pp)%>%hide_legend(), titleX=T,titleY=T,margin=0.035,widths=c(0.375,0.425,0.2),which_layout=1) %>% partial_bundle()
```
### maf = 0.25
```{r}
pca=PCA_list$Prune_filtered$maf0.25[[1]]
data_pca=data.frame(INDIV=pca$sample.id,
PC1=pca$eigenvect[,1],
PC2=pca$eigenvect[,2],
PC3=pca$eigenvect[,3],
PC4=pca$eigenvect[,4],
LOCA=c(rep("Algarve",5),
rep("Bay of Biscay",5),
rep("Gulf of Lion",5),
rep("Costa Calida",5)))
color_med_atl=rev(brewer.pal(n=4,name="RdBu"))
p<-ggplot(data=data_pca,aes(x=PC1,y=PC2,label=INDIV))+
theme_minimal()+
theme(panel.grid=element_blank(),
panel.border=element_rect(fill="transparent"),
plot.title=element_text(hjust=0.5))+
geom_hline(yintercept=0,lty=2)+
geom_vline(xintercept=0,lty=2)+
geom_point(size=3,aes(col=LOCA))+
xlab(paste("PCA 1 (",round(pca$varprop[1]*100,2),"% )",sep=""))+
ylab(paste("PCA 2 (",round(pca$varprop[2]*100,2),"% )",sep=""))+
scale_colour_manual(name="Location",
values=c(color_med_atl[2],
color_med_atl[1],
color_med_atl[3],
color_med_atl[4]))
p1<-p
p<-ggplot(data=data_pca,aes(x=PC3,y=PC4,label=INDIV))+
theme_minimal()+
theme(panel.grid=element_blank(),
panel.border=element_rect(fill="transparent"),
plot.title=element_text(hjust=0.5))+
geom_hline(yintercept=0,lty=2)+
geom_vline(xintercept=0,lty=2)+
geom_point(size=3,aes(col=LOCA))+
xlab(paste("PCA 3 (",round(pca$varprop[3]*100,2),"% )",sep=""))+
ylab(paste("PCA 4 (",round(pca$varprop[4]*100,2),"% )",sep=""))+
scale_colour_manual(name="Location",
values=c(color_med_atl[2],
color_med_atl[1],
color_med_atl[3],
color_med_atl[4]))
p2<-p
data_varpop=data.frame(PC=factor(paste("P",seq(1,10),sep=""),levels=paste("P",seq(1,10),sep="")),VAR=pca$varprop[1:10])
pp<-ggplot(data_varpop,aes(x=PC,y=VAR))+
geom_bar(stat='identity',fill="dodgerblue2",alpha=0.25)+
theme_classic()+
xlab("Principal Component")+
ylab("Variation explained (%)")
```
```{r}
subplot(ggplotly(p1)%>% layout(legend = list(orientation = "h", x = 0.2, y =-0.15)), ggplotly(p2)%>%hide_legend(), ggplotly(pp)%>%hide_legend(), titleX=T,titleY=T,margin=0.035,widths=c(0.375,0.425,0.2),which_layout=1) %>% partial_bundle()
```
### maf = 0.30
```{r}
pca=PCA_list$Prune_filtered$maf0.3[[1]]
data_pca=data.frame(INDIV=pca$sample.id,
PC1=pca$eigenvect[,1],
PC2=pca$eigenvect[,2],
PC3=pca$eigenvect[,3],
PC4=pca$eigenvect[,4],
LOCA=c(rep("Algarve",5),
rep("Bay of Biscay",5),
rep("Gulf of Lion",5),
rep("Costa Calida",5)))
color_med_atl=rev(brewer.pal(n=4,name="RdBu"))
p<-ggplot(data=data_pca,aes(x=PC1,y=PC2,label=INDIV))+
theme_minimal()+
theme(panel.grid=element_blank(),
panel.border=element_rect(fill="transparent"),
plot.title=element_text(hjust=0.5))+
geom_hline(yintercept=0,lty=2)+
geom_vline(xintercept=0,lty=2)+
geom_point(size=3,aes(col=LOCA))+
xlab(paste("PCA 1 (",round(pca$varprop[1]*100,2),"% )",sep=""))+
ylab(paste("PCA 2 (",round(pca$varprop[2]*100,2),"% )",sep=""))+
scale_colour_manual(name="Location",
values=c(color_med_atl[2],
color_med_atl[1],
color_med_atl[3],
color_med_atl[4]))
p1<-p
p<-ggplot(data=data_pca,aes(x=PC3,y=PC4,label=INDIV))+
theme_minimal()+
theme(panel.grid=element_blank(),
panel.border=element_rect(fill="transparent"),
plot.title=element_text(hjust=0.5))+
geom_hline(yintercept=0,lty=2)+
geom_vline(xintercept=0,lty=2)+
geom_point(size=3,aes(col=LOCA))+
xlab(paste("PCA 3 (",round(pca$varprop[3]*100,2),"% )",sep=""))+
ylab(paste("PCA 4 (",round(pca$varprop[4]*100,2),"% )",sep=""))+
scale_colour_manual(name="Location",
values=c(color_med_atl[2],
color_med_atl[1],
color_med_atl[3],
color_med_atl[4]))
p2<-p
data_varpop=data.frame(PC=factor(paste("P",seq(1,10),sep=""),levels=paste("P",seq(1,10),sep="")),VAR=pca$varprop[1:10])
pp<-ggplot(data_varpop,aes(x=PC,y=VAR))+
geom_bar(stat='identity',fill="dodgerblue2",alpha=0.25)+
theme_classic()+
xlab("Principal Component")+
ylab("Variation explained (%)")
```
```{r}
subplot(ggplotly(p1)%>% layout(legend = list(orientation = "h", x = 0.2, y =-0.15)), ggplotly(p2)%>%hide_legend(), ggplotly(pp)%>%hide_legend(), titleX=T,titleY=T,margin=0.035,widths=c(0.375,0.425,0.2),which_layout=1) %>% partial_bundle()
```
### maf = 0.35
```{r}
pca=PCA_list$Prune_filtered$maf0.35[[1]]
data_pca=data.frame(INDIV=pca$sample.id,
PC1=pca$eigenvect[,1],
PC2=pca$eigenvect[,2],
PC3=pca$eigenvect[,3],
PC4=pca$eigenvect[,4],
LOCA=c(rep("Algarve",5),
rep("Bay of Biscay",5),
rep("Gulf of Lion",5),
rep("Costa Calida",5)))
color_med_atl=rev(brewer.pal(n=4,name="RdBu"))
p<-ggplot(data=data_pca,aes(x=PC1,y=PC2,label=INDIV))+
theme_minimal()+
theme(panel.grid=element_blank(),
panel.border=element_rect(fill="transparent"),
plot.title=element_text(hjust=0.5))+
geom_hline(yintercept=0,lty=2)+
geom_vline(xintercept=0,lty=2)+
geom_point(size=3,aes(col=LOCA))+
xlab(paste("PCA 1 (",round(pca$varprop[1]*100,2),"% )",sep=""))+
ylab(paste("PCA 2 (",round(pca$varprop[2]*100,2),"% )",sep=""))+
scale_colour_manual(name="Location",
values=c(color_med_atl[2],
color_med_atl[1],
color_med_atl[3],
color_med_atl[4]))
p1<-p
p<-ggplot(data=data_pca,aes(x=PC3,y=PC4,label=INDIV))+
theme_minimal()+
theme(panel.grid=element_blank(),
panel.border=element_rect(fill="transparent"),
plot.title=element_text(hjust=0.5))+
geom_hline(yintercept=0,lty=2)+
geom_vline(xintercept=0,lty=2)+
geom_point(size=3,aes(col=LOCA))+
xlab(paste("PCA 3 (",round(pca$varprop[3]*100,2),"% )",sep=""))+
ylab(paste("PCA 4 (",round(pca$varprop[4]*100,2),"% )",sep=""))+
scale_colour_manual(name="Location",
values=c(color_med_atl[2],
color_med_atl[1],
color_med_atl[3],
color_med_atl[4]))
p2<-p
data_varpop=data.frame(PC=factor(paste("P",seq(1,10),sep=""),levels=paste("P",seq(1,10),sep="")),VAR=pca$varprop[1:10])
pp<-ggplot(data_varpop,aes(x=PC,y=VAR))+
geom_bar(stat='identity',fill="dodgerblue2",alpha=0.25)+
theme_classic()+
xlab("Principal Component")+
ylab("Variation explained (%)")
```
```{r}
subplot(ggplotly(p1)%>% layout(legend = list(orientation = "h", x = 0.2, y =-0.15)), ggplotly(p2)%>%hide_legend(), ggplotly(pp)%>%hide_legend(), titleX=T,titleY=T,margin=0.035,widths=c(0.375,0.425,0.2),which_layout=1) %>% partial_bundle()
```
### maf = 0.40
```{r}
pca=PCA_list$Prune_filtered$maf0.4[[1]]
data_pca=data.frame(INDIV=pca$sample.id,
PC1=pca$eigenvect[,1],
PC2=pca$eigenvect[,2],
PC3=pca$eigenvect[,3],
PC4=pca$eigenvect[,4],
LOCA=c(rep("Algarve",5),
rep("Bay of Biscay",5),
rep("Gulf of Lion",5),
rep("Costa Calida",5)))
color_med_atl=rev(brewer.pal(n=4,name="RdBu"))
p<-ggplot(data=data_pca,aes(x=PC1,y=PC2,label=INDIV))+
theme_minimal()+
theme(panel.grid=element_blank(),
panel.border=element_rect(fill="transparent"),
plot.title=element_text(hjust=0.5))+
geom_hline(yintercept=0,lty=2)+
geom_vline(xintercept=0,lty=2)+
geom_point(size=3,aes(col=LOCA))+
xlab(paste("PCA 1 (",round(pca$varprop[1]*100,2),"% )",sep=""))+
ylab(paste("PCA 2 (",round(pca$varprop[2]*100,2),"% )",sep=""))+
scale_colour_manual(name="Location",
values=c(color_med_atl[2],
color_med_atl[1],
color_med_atl[3],
color_med_atl[4]))
p1<-p
p<-ggplot(data=data_pca,aes(x=PC3,y=PC4,label=INDIV))+
theme_minimal()+
theme(panel.grid=element_blank(),
panel.border=element_rect(fill="transparent"),
plot.title=element_text(hjust=0.5))+
geom_hline(yintercept=0,lty=2)+
geom_vline(xintercept=0,lty=2)+
geom_point(size=3,aes(col=LOCA))+
xlab(paste("PCA 3 (",round(pca$varprop[3]*100,2),"% )",sep=""))+
ylab(paste("PCA 4 (",round(pca$varprop[4]*100,2),"% )",sep=""))+
scale_colour_manual(name="Location",
values=c(color_med_atl[2],
color_med_atl[1],
color_med_atl[3],
color_med_atl[4]))
p2<-p
data_varpop=data.frame(PC=factor(paste("P",seq(1,10),sep=""),levels=paste("P",seq(1,10),sep="")),VAR=pca$varprop[1:10])
pp<-ggplot(data_varpop,aes(x=PC,y=VAR))+
geom_bar(stat='identity',fill="dodgerblue2",alpha=0.25)+
theme_classic()+
xlab("Principal Component")+
ylab("Variation explained (%)")
```
```{r}
subplot(ggplotly(p1)%>% layout(legend = list(orientation = "h", x = 0.2, y =-0.15)), ggplotly(p2)%>%hide_legend(), ggplotly(pp)%>%hide_legend(), titleX=T,titleY=T,margin=0.035,widths=c(0.375,0.425,0.2),which_layout=1) %>% partial_bundle()
```
### maf = 0.45
```{r}
pca=PCA_list$Prune_filtered$maf0.45[[1]]
data_pca=data.frame(INDIV=pca$sample.id,
PC1=pca$eigenvect[,1],
PC2=pca$eigenvect[,2],
PC3=pca$eigenvect[,3],
PC4=pca$eigenvect[,4],
LOCA=c(rep("Algarve",5),
rep("Bay of Biscay",5),
rep("Gulf of Lion",5),
rep("Costa Calida",5)))
color_med_atl=rev(brewer.pal(n=4,name="RdBu"))
p<-ggplot(data=data_pca,aes(x=PC1,y=PC2,label=INDIV))+
theme_minimal()+
theme(panel.grid=element_blank(),
panel.border=element_rect(fill="transparent"),
plot.title=element_text(hjust=0.5))+
geom_hline(yintercept=0,lty=2)+
geom_vline(xintercept=0,lty=2)+
geom_point(size=3,aes(col=LOCA))+
xlab(paste("PCA 1 (",round(pca$varprop[1]*100,2),"% )",sep=""))+
ylab(paste("PCA 2 (",round(pca$varprop[2]*100,2),"% )",sep=""))+
scale_colour_manual(name="Location",
values=c(color_med_atl[2],
color_med_atl[1],
color_med_atl[3],
color_med_atl[4]))
p1<-p
p<-ggplot(data=data_pca,aes(x=PC3,y=PC4,label=INDIV))+
theme_minimal()+
theme(panel.grid=element_blank(),
panel.border=element_rect(fill="transparent"),
plot.title=element_text(hjust=0.5))+
geom_hline(yintercept=0,lty=2)+
geom_vline(xintercept=0,lty=2)+
geom_point(size=3,aes(col=LOCA))+
xlab(paste("PCA 3 (",round(pca$varprop[3]*100,2),"% )",sep=""))+
ylab(paste("PCA 4 (",round(pca$varprop[4]*100,2),"% )",sep=""))+
scale_colour_manual(name="Location",
values=c(color_med_atl[2],
color_med_atl[1],
color_med_atl[3],
color_med_atl[4]))
p2<-p
data_varpop=data.frame(PC=factor(paste("P",seq(1,10),sep=""),levels=paste("P",seq(1,10),sep="")),VAR=pca$varprop[1:10])
pp<-ggplot(data_varpop,aes(x=PC,y=VAR))+
geom_bar(stat='identity',fill="dodgerblue2",alpha=0.25)+
theme_classic()+
xlab("Principal Component")+
ylab("Variation explained (%)")
```
```{r}
subplot(ggplotly(p1)%>% layout(legend = list(orientation = "h", x = 0.2, y =-0.15)), ggplotly(p2)%>%hide_legend(), ggplotly(pp)%>%hide_legend(), titleX=T,titleY=T,margin=0.035,widths=c(0.375,0.425,0.2),which_layout=1) %>% partial_bundle()
```
### maf = 0.50
```{r}
pca=PCA_list$Prune_filtered$maf0.5[[1]]
data_pca=data.frame(INDIV=pca$sample.id,
PC1=pca$eigenvect[,1],
PC2=pca$eigenvect[,2],
PC3=pca$eigenvect[,3],
PC4=pca$eigenvect[,4],
LOCA=c(rep("Algarve",5),
rep("Bay of Biscay",5),
rep("Gulf of Lion",5),
rep("Costa Calida",5)))
color_med_atl=rev(brewer.pal(n=4,name="RdBu"))
p<-ggplot(data=data_pca,aes(x=PC1,y=PC2,label=INDIV))+
theme_minimal()+
theme(panel.grid=element_blank(),
panel.border=element_rect(fill="transparent"),
plot.title=element_text(hjust=0.5))+
geom_hline(yintercept=0,lty=2)+
geom_vline(xintercept=0,lty=2)+
geom_point(size=3,aes(col=LOCA))+
xlab(paste("PCA 1 (",round(pca$varprop[1]*100,2),"% )",sep=""))+
ylab(paste("PCA 2 (",round(pca$varprop[2]*100,2),"% )",sep=""))+
scale_colour_manual(name="Location",
values=c(color_med_atl[2],
color_med_atl[1],
color_med_atl[3],
color_med_atl[4]))
p1<-p
p<-ggplot(data=data_pca,aes(x=PC3,y=PC4,label=INDIV))+
theme_minimal()+
theme(panel.grid=element_blank(),
panel.border=element_rect(fill="transparent"),
plot.title=element_text(hjust=0.5))+
geom_hline(yintercept=0,lty=2)+
geom_vline(xintercept=0,lty=2)+
geom_point(size=3,aes(col=LOCA))+
xlab(paste("PCA 3 (",round(pca$varprop[3]*100,2),"% )",sep=""))+
ylab(paste("PCA 4 (",round(pca$varprop[4]*100,2),"% )",sep=""))+
scale_colour_manual(name="Location",
values=c(color_med_atl[2],
color_med_atl[1],
color_med_atl[3],
color_med_atl[4]))
p2<-p
data_varpop=data.frame(PC=factor(paste("P",seq(1,10),sep=""),levels=paste("P",seq(1,10),sep="")),VAR=pca$varprop[1:10])
pp<-ggplot(data_varpop,aes(x=PC,y=VAR))+
geom_bar(stat='identity',fill="dodgerblue2",alpha=0.25)+
theme_classic()+
xlab("Principal Component")+
ylab("Variation explained (%)")
```
```{r}
subplot(ggplotly(p1)%>% layout(legend = list(orientation = "h", x = 0.2, y =-0.15)), ggplotly(p2)%>%hide_legend(), ggplotly(pp)%>%hide_legend(), titleX=T,titleY=T,margin=0.035,widths=c(0.375,0.425,0.2),which_layout=1) %>% partial_bundle()
```
Row {.tabset data-height=50}
-----------------------
<center>
<font size="6">**All unfiltered SNPS**</font>
</center>
Row {.tabset data-height=600}
-----------------------
### maf = 0
```{r}
pca=PCA_list$All_unfiltered$maf0[[1]]
data_pca=data.frame(INDIV=pca$sample.id,
PC1=pca$eigenvect[,1],
PC2=pca$eigenvect[,2],
PC3=pca$eigenvect[,3],
PC4=pca$eigenvect[,4],
LOCA=c(rep("Algarve",5),
rep("Bay of Biscay",5),
rep("Gulf of Lion",5),
rep("Costa Calida",5)))
color_med_atl=rev(brewer.pal(n=4,name="RdBu"))
p<-ggplot(data=data_pca,aes(x=PC1,y=PC2,label=INDIV))+
theme_minimal()+
theme(panel.grid=element_blank(),
panel.border=element_rect(fill="transparent"),
plot.title=element_text(hjust=0.5))+
geom_hline(yintercept=0,lty=2)+
geom_vline(xintercept=0,lty=2)+
geom_point(size=3,aes(col=LOCA))+
xlab(paste("PCA 1 (",round(pca$varprop[1]*100,2),"% )",sep=""))+
ylab(paste("PCA 2 (",round(pca$varprop[2]*100,2),"% )",sep=""))+
scale_colour_manual(name="Location",
values=c(color_med_atl[2],
color_med_atl[1],
color_med_atl[3],
color_med_atl[4]))
p1<-p
p<-ggplot(data=data_pca,aes(x=PC3,y=PC4,label=INDIV))+
theme_minimal()+
theme(panel.grid=element_blank(),
panel.border=element_rect(fill="transparent"),
plot.title=element_text(hjust=0.5))+
geom_hline(yintercept=0,lty=2)+
geom_vline(xintercept=0,lty=2)+
geom_point(size=3,aes(col=LOCA))+
xlab(paste("PCA 3 (",round(pca$varprop[3]*100,2),"% )",sep=""))+
ylab(paste("PCA 4 (",round(pca$varprop[4]*100,2),"% )",sep=""))+
scale_colour_manual(name="Location",
values=c(color_med_atl[2],
color_med_atl[1],
color_med_atl[3],
color_med_atl[4]))
p2<-p
data_varpop=data.frame(PC=factor(paste("P",seq(1,10),sep=""),levels=paste("P",seq(1,10),sep="")),VAR=pca$varprop[1:10])
pp<-ggplot(data_varpop,aes(x=PC,y=VAR))+
geom_bar(stat='identity',fill="dodgerblue2",alpha=0.25)+
theme_classic()+
xlab("Principal Component")+
ylab("Variation explained (%)")
```
```{r}
subplot(ggplotly(p1)%>% layout(legend = list(orientation = "h", x = 0.2, y =-0.15)), ggplotly(p2)%>%hide_legend(), ggplotly(pp)%>%hide_legend(), titleX=T,titleY=T,margin=0.035,widths=c(0.375,0.425,0.2),which_layout=1) %>% partial_bundle()
```
### maf = 0.05
```{r}
pca=PCA_list$All_unfiltered$maf0.05[[1]]
data_pca=data.frame(INDIV=pca$sample.id,
PC1=pca$eigenvect[,1],
PC2=pca$eigenvect[,2],
PC3=pca$eigenvect[,3],
PC4=pca$eigenvect[,4],
LOCA=c(rep("Algarve",5),
rep("Bay of Biscay",5),
rep("Gulf of Lion",5),
rep("Costa Calida",5)))
color_med_atl=rev(brewer.pal(n=4,name="RdBu"))
p<-ggplot(data=data_pca,aes(x=PC1,y=PC2,label=INDIV))+
theme_minimal()+
theme(panel.grid=element_blank(),
panel.border=element_rect(fill="transparent"),
plot.title=element_text(hjust=0.5))+
geom_hline(yintercept=0,lty=2)+
geom_vline(xintercept=0,lty=2)+
geom_point(size=3,aes(col=LOCA))+
xlab(paste("PCA 1 (",round(pca$varprop[1]*100,2),"% )",sep=""))+
ylab(paste("PCA 2 (",round(pca$varprop[2]*100,2),"% )",sep=""))+
scale_colour_manual(name="Location",
values=c(color_med_atl[2],
color_med_atl[1],
color_med_atl[3],
color_med_atl[4]))
p1<-p
p<-ggplot(data=data_pca,aes(x=PC3,y=PC4,label=INDIV))+
theme_minimal()+
theme(panel.grid=element_blank(),
panel.border=element_rect(fill="transparent"),
plot.title=element_text(hjust=0.5))+
geom_hline(yintercept=0,lty=2)+
geom_vline(xintercept=0,lty=2)+
geom_point(size=3,aes(col=LOCA))+
xlab(paste("PCA 3 (",round(pca$varprop[3]*100,2),"% )",sep=""))+
ylab(paste("PCA 4 (",round(pca$varprop[4]*100,2),"% )",sep=""))+
scale_colour_manual(name="Location",
values=c(color_med_atl[2],
color_med_atl[1],
color_med_atl[3],
color_med_atl[4]))
p2<-p
data_varpop=data.frame(PC=factor(paste("P",seq(1,10),sep=""),levels=paste("P",seq(1,10),sep="")),VAR=pca$varprop[1:10])
pp<-ggplot(data_varpop,aes(x=PC,y=VAR))+
geom_bar(stat='identity',fill="dodgerblue2",alpha=0.25)+
theme_classic()+
xlab("Principal Component")+
ylab("Variation explained (%)")
```
```{r}
subplot(ggplotly(p1)%>% layout(legend = list(orientation = "h", x = 0.2, y =-0.15)), ggplotly(p2)%>%hide_legend(), ggplotly(pp)%>%hide_legend(), titleX=T,titleY=T,margin=0.035,widths=c(0.375,0.425,0.2),which_layout=1) %>% partial_bundle()
```
### maf = 0.1
```{r}
pca=PCA_list$All_unfiltered$maf0.1[[1]]
data_pca=data.frame(INDIV=pca$sample.id,
PC1=pca$eigenvect[,1],
PC2=pca$eigenvect[,2],
PC3=pca$eigenvect[,3],
PC4=pca$eigenvect[,4],
LOCA=c(rep("Algarve",5),
rep("Bay of Biscay",5),
rep("Gulf of Lion",5),
rep("Costa Calida",5)))
color_med_atl=rev(brewer.pal(n=4,name="RdBu"))
p<-ggplot(data=data_pca,aes(x=PC1,y=PC2,label=INDIV))+
theme_minimal()+
theme(panel.grid=element_blank(),
panel.border=element_rect(fill="transparent"),
plot.title=element_text(hjust=0.5))+
geom_hline(yintercept=0,lty=2)+
geom_vline(xintercept=0,lty=2)+
geom_point(size=3,aes(col=LOCA))+
xlab(paste("PCA 1 (",round(pca$varprop[1]*100,2),"% )",sep=""))+
ylab(paste("PCA 2 (",round(pca$varprop[2]*100,2),"% )",sep=""))+
scale_colour_manual(name="Location",
values=c(color_med_atl[2],
color_med_atl[1],
color_med_atl[3],
color_med_atl[4]))
p1<-p
p<-ggplot(data=data_pca,aes(x=PC3,y=PC4,label=INDIV))+
theme_minimal()+
theme(panel.grid=element_blank(),
panel.border=element_rect(fill="transparent"),
plot.title=element_text(hjust=0.5))+
geom_hline(yintercept=0,lty=2)+
geom_vline(xintercept=0,lty=2)+
geom_point(size=3,aes(col=LOCA))+
xlab(paste("PCA 3 (",round(pca$varprop[3]*100,2),"% )",sep=""))+
ylab(paste("PCA 4 (",round(pca$varprop[4]*100,2),"% )",sep=""))+
scale_colour_manual(name="Location",
values=c(color_med_atl[2],
color_med_atl[1],
color_med_atl[3],
color_med_atl[4]))
p2<-p
data_varpop=data.frame(PC=factor(paste("P",seq(1,10),sep=""),levels=paste("P",seq(1,10),sep="")),VAR=pca$varprop[1:10])
pp<-ggplot(data_varpop,aes(x=PC,y=VAR))+
geom_bar(stat='identity',fill="dodgerblue2",alpha=0.25)+
theme_classic()+
xlab("Principal Component")+
ylab("Variation explained (%)")
```
```{r}
subplot(ggplotly(p1)%>% layout(legend = list(orientation = "h", x = 0.2, y =-0.15)), ggplotly(p2)%>%hide_legend(), ggplotly(pp)%>%hide_legend(), titleX=T,titleY=T,margin=0.035,widths=c(0.375,0.425,0.2),which_layout=1) %>% partial_bundle()
```
### maf = 0.15
```{r}
pca=PCA_list$All_unfiltered$maf0.15[[1]]
data_pca=data.frame(INDIV=pca$sample.id,
PC1=pca$eigenvect[,1],
PC2=pca$eigenvect[,2],
PC3=pca$eigenvect[,3],
PC4=pca$eigenvect[,4],
LOCA=c(rep("Algarve",5),
rep("Bay of Biscay",5),
rep("Gulf of Lion",5),
rep("Costa Calida",5)))
color_med_atl=rev(brewer.pal(n=4,name="RdBu"))
p<-ggplot(data=data_pca,aes(x=PC1,y=PC2,label=INDIV))+
theme_minimal()+
theme(panel.grid=element_blank(),
panel.border=element_rect(fill="transparent"),
plot.title=element_text(hjust=0.5))+
geom_hline(yintercept=0,lty=2)+
geom_vline(xintercept=0,lty=2)+
geom_point(size=3,aes(col=LOCA))+
xlab(paste("PCA 1 (",round(pca$varprop[1]*100,2),"% )",sep=""))+
ylab(paste("PCA 2 (",round(pca$varprop[2]*100,2),"% )",sep=""))+
scale_colour_manual(name="Location",
values=c(color_med_atl[2],
color_med_atl[1],
color_med_atl[3],
color_med_atl[4]))
p1<-p
p<-ggplot(data=data_pca,aes(x=PC3,y=PC4,label=INDIV))+
theme_minimal()+
theme(panel.grid=element_blank(),
panel.border=element_rect(fill="transparent"),
plot.title=element_text(hjust=0.5))+
geom_hline(yintercept=0,lty=2)+
geom_vline(xintercept=0,lty=2)+
geom_point(size=3,aes(col=LOCA))+
xlab(paste("PCA 3 (",round(pca$varprop[3]*100,2),"% )",sep=""))+
ylab(paste("PCA 4 (",round(pca$varprop[4]*100,2),"% )",sep=""))+
scale_colour_manual(name="Location",
values=c(color_med_atl[2],
color_med_atl[1],
color_med_atl[3],
color_med_atl[4]))
p2<-p
data_varpop=data.frame(PC=factor(paste("P",seq(1,10),sep=""),levels=paste("P",seq(1,10),sep="")),VAR=pca$varprop[1:10])
pp<-ggplot(data_varpop,aes(x=PC,y=VAR))+
geom_bar(stat='identity',fill="dodgerblue2",alpha=0.25)+
theme_classic()+
xlab("Principal Component")+
ylab("Variation explained (%)")
```
```{r}
subplot(ggplotly(p1)%>% layout(legend = list(orientation = "h", x = 0.2, y =-0.15)), ggplotly(p2)%>%hide_legend(), ggplotly(pp)%>%hide_legend(), titleX=T,titleY=T,margin=0.035,widths=c(0.375,0.425,0.2),which_layout=1) %>% partial_bundle()
```
### maf = 0.20
```{r}
pca=PCA_list$All_unfiltered$maf0.2[[1]]
data_pca=data.frame(INDIV=pca$sample.id,
PC1=pca$eigenvect[,1],
PC2=pca$eigenvect[,2],
PC3=pca$eigenvect[,3],
PC4=pca$eigenvect[,4],
LOCA=c(rep("Algarve",5),
rep("Bay of Biscay",5),
rep("Gulf of Lion",5),
rep("Costa Calida",5)))
color_med_atl=rev(brewer.pal(n=4,name="RdBu"))
p<-ggplot(data=data_pca,aes(x=PC1,y=PC2,label=INDIV))+
theme_minimal()+
theme(panel.grid=element_blank(),
panel.border=element_rect(fill="transparent"),
plot.title=element_text(hjust=0.5))+
geom_hline(yintercept=0,lty=2)+
geom_vline(xintercept=0,lty=2)+
geom_point(size=3,aes(col=LOCA))+
xlab(paste("PCA 1 (",round(pca$varprop[1]*100,2),"% )",sep=""))+
ylab(paste("PCA 2 (",round(pca$varprop[2]*100,2),"% )",sep=""))+
scale_colour_manual(name="Location",
values=c(color_med_atl[2],
color_med_atl[1],
color_med_atl[3],
color_med_atl[4]))
p1<-p
p<-ggplot(data=data_pca,aes(x=PC3,y=PC4,label=INDIV))+
theme_minimal()+
theme(panel.grid=element_blank(),
panel.border=element_rect(fill="transparent"),
plot.title=element_text(hjust=0.5))+
geom_hline(yintercept=0,lty=2)+
geom_vline(xintercept=0,lty=2)+
geom_point(size=3,aes(col=LOCA))+
xlab(paste("PCA 3 (",round(pca$varprop[3]*100,2),"% )",sep=""))+
ylab(paste("PCA 4 (",round(pca$varprop[4]*100,2),"% )",sep=""))+
scale_colour_manual(name="Location",
values=c(color_med_atl[2],
color_med_atl[1],
color_med_atl[3],
color_med_atl[4]))
p2<-p
data_varpop=data.frame(PC=factor(paste("P",seq(1,10),sep=""),levels=paste("P",seq(1,10),sep="")),VAR=pca$varprop[1:10])
pp<-ggplot(data_varpop,aes(x=PC,y=VAR))+
geom_bar(stat='identity',fill="dodgerblue2",alpha=0.25)+
theme_classic()+
xlab("Principal Component")+
ylab("Variation explained (%)")
```
```{r}
subplot(ggplotly(p1)%>% layout(legend = list(orientation = "h", x = 0.2, y =-0.15)), ggplotly(p2)%>%hide_legend(), ggplotly(pp)%>%hide_legend(), titleX=T,titleY=T,margin=0.035,widths=c(0.375,0.425,0.2),which_layout=1) %>% partial_bundle()
```
### maf = 0.25
```{r}
pca=PCA_list$All_unfiltered$maf0.25[[1]]
data_pca=data.frame(INDIV=pca$sample.id,
PC1=pca$eigenvect[,1],
PC2=pca$eigenvect[,2],
PC3=pca$eigenvect[,3],
PC4=pca$eigenvect[,4],
LOCA=c(rep("Algarve",5),
rep("Bay of Biscay",5),
rep("Gulf of Lion",5),
rep("Costa Calida",5)))
color_med_atl=rev(brewer.pal(n=4,name="RdBu"))
p<-ggplot(data=data_pca,aes(x=PC1,y=PC2,label=INDIV))+
theme_minimal()+
theme(panel.grid=element_blank(),
panel.border=element_rect(fill="transparent"),
plot.title=element_text(hjust=0.5))+
geom_hline(yintercept=0,lty=2)+
geom_vline(xintercept=0,lty=2)+
geom_point(size=3,aes(col=LOCA))+
xlab(paste("PCA 1 (",round(pca$varprop[1]*100,2),"% )",sep=""))+
ylab(paste("PCA 2 (",round(pca$varprop[2]*100,2),"% )",sep=""))+
scale_colour_manual(name="Location",
values=c(color_med_atl[2],
color_med_atl[1],
color_med_atl[3],
color_med_atl[4]))
p1<-p
p<-ggplot(data=data_pca,aes(x=PC3,y=PC4,label=INDIV))+
theme_minimal()+
theme(panel.grid=element_blank(),
panel.border=element_rect(fill="transparent"),
plot.title=element_text(hjust=0.5))+
geom_hline(yintercept=0,lty=2)+
geom_vline(xintercept=0,lty=2)+
geom_point(size=3,aes(col=LOCA))+
xlab(paste("PCA 3 (",round(pca$varprop[3]*100,2),"% )",sep=""))+
ylab(paste("PCA 4 (",round(pca$varprop[4]*100,2),"% )",sep=""))+
scale_colour_manual(name="Location",
values=c(color_med_atl[2],
color_med_atl[1],
color_med_atl[3],
color_med_atl[4]))
p2<-p
data_varpop=data.frame(PC=factor(paste("P",seq(1,10),sep=""),levels=paste("P",seq(1,10),sep="")),VAR=pca$varprop[1:10])
pp<-ggplot(data_varpop,aes(x=PC,y=VAR))+
geom_bar(stat='identity',fill="dodgerblue2",alpha=0.25)+
theme_classic()+
xlab("Principal Component")+
ylab("Variation explained (%)")
```
```{r}
subplot(ggplotly(p1)%>% layout(legend = list(orientation = "h", x = 0.2, y =-0.15)), ggplotly(p2)%>%hide_legend(), ggplotly(pp)%>%hide_legend(), titleX=T,titleY=T,margin=0.035,widths=c(0.375,0.425,0.2),which_layout=1) %>% partial_bundle()
```
### maf = 0.30
```{r}
pca=PCA_list$All_unfiltered$maf0.3[[1]]
data_pca=data.frame(INDIV=pca$sample.id,
PC1=pca$eigenvect[,1],
PC2=pca$eigenvect[,2],
PC3=pca$eigenvect[,3],
PC4=pca$eigenvect[,4],
LOCA=c(rep("Algarve",5),
rep("Bay of Biscay",5),
rep("Gulf of Lion",5),
rep("Costa Calida",5)))
color_med_atl=rev(brewer.pal(n=4,name="RdBu"))
p<-ggplot(data=data_pca,aes(x=PC1,y=PC2,label=INDIV))+
theme_minimal()+
theme(panel.grid=element_blank(),
panel.border=element_rect(fill="transparent"),
plot.title=element_text(hjust=0.5))+
geom_hline(yintercept=0,lty=2)+
geom_vline(xintercept=0,lty=2)+
geom_point(size=3,aes(col=LOCA))+
xlab(paste("PCA 1 (",round(pca$varprop[1]*100,2),"% )",sep=""))+
ylab(paste("PCA 2 (",round(pca$varprop[2]*100,2),"% )",sep=""))+
scale_colour_manual(name="Location",
values=c(color_med_atl[2],
color_med_atl[1],
color_med_atl[3],
color_med_atl[4]))
p1<-p
p<-ggplot(data=data_pca,aes(x=PC3,y=PC4,label=INDIV))+
theme_minimal()+
theme(panel.grid=element_blank(),
panel.border=element_rect(fill="transparent"),
plot.title=element_text(hjust=0.5))+
geom_hline(yintercept=0,lty=2)+
geom_vline(xintercept=0,lty=2)+
geom_point(size=3,aes(col=LOCA))+
xlab(paste("PCA 3 (",round(pca$varprop[3]*100,2),"% )",sep=""))+
ylab(paste("PCA 4 (",round(pca$varprop[4]*100,2),"% )",sep=""))+
scale_colour_manual(name="Location",
values=c(color_med_atl[2],
color_med_atl[1],
color_med_atl[3],
color_med_atl[4]))
p2<-p
data_varpop=data.frame(PC=factor(paste("P",seq(1,10),sep=""),levels=paste("P",seq(1,10),sep="")),VAR=pca$varprop[1:10])
pp<-ggplot(data_varpop,aes(x=PC,y=VAR))+
geom_bar(stat='identity',fill="dodgerblue2",alpha=0.25)+
theme_classic()+
xlab("Principal Component")+
ylab("Variation explained (%)")
```
```{r}
subplot(ggplotly(p1)%>% layout(legend = list(orientation = "h", x = 0.2, y =-0.15)), ggplotly(p2)%>%hide_legend(), ggplotly(pp)%>%hide_legend(), titleX=T,titleY=T,margin=0.035,widths=c(0.375,0.425,0.2),which_layout=1) %>% partial_bundle()
```
### maf = 0.35
```{r}
pca=PCA_list$All_unfiltered$maf0.35[[1]]
data_pca=data.frame(INDIV=pca$sample.id,
PC1=pca$eigenvect[,1],
PC2=pca$eigenvect[,2],
PC3=pca$eigenvect[,3],
PC4=pca$eigenvect[,4],
LOCA=c(rep("Algarve",5),
rep("Bay of Biscay",5),
rep("Gulf of Lion",5),
rep("Costa Calida",5)))
color_med_atl=rev(brewer.pal(n=4,name="RdBu"))
p<-ggplot(data=data_pca,aes(x=PC1,y=PC2,label=INDIV))+
theme_minimal()+
theme(panel.grid=element_blank(),
panel.border=element_rect(fill="transparent"),
plot.title=element_text(hjust=0.5))+
geom_hline(yintercept=0,lty=2)+
geom_vline(xintercept=0,lty=2)+
geom_point(size=3,aes(col=LOCA))+
xlab(paste("PCA 1 (",round(pca$varprop[1]*100,2),"% )",sep=""))+
ylab(paste("PCA 2 (",round(pca$varprop[2]*100,2),"% )",sep=""))+
scale_colour_manual(name="Location",
values=c(color_med_atl[2],
color_med_atl[1],
color_med_atl[3],
color_med_atl[4]))
p1<-p
p<-ggplot(data=data_pca,aes(x=PC3,y=PC4,label=INDIV))+
theme_minimal()+
theme(panel.grid=element_blank(),
panel.border=element_rect(fill="transparent"),
plot.title=element_text(hjust=0.5))+
geom_hline(yintercept=0,lty=2)+
geom_vline(xintercept=0,lty=2)+
geom_point(size=3,aes(col=LOCA))+
xlab(paste("PCA 3 (",round(pca$varprop[3]*100,2),"% )",sep=""))+
ylab(paste("PCA 4 (",round(pca$varprop[4]*100,2),"% )",sep=""))+
scale_colour_manual(name="Location",
values=c(color_med_atl[2],
color_med_atl[1],
color_med_atl[3],
color_med_atl[4]))
p2<-p
data_varpop=data.frame(PC=factor(paste("P",seq(1,10),sep=""),levels=paste("P",seq(1,10),sep="")),VAR=pca$varprop[1:10])
pp<-ggplot(data_varpop,aes(x=PC,y=VAR))+
geom_bar(stat='identity',fill="dodgerblue2",alpha=0.25)+
theme_classic()+
xlab("Principal Component")+
ylab("Variation explained (%)")
```
```{r}
subplot(ggplotly(p1)%>% layout(legend = list(orientation = "h", x = 0.2, y =-0.15)), ggplotly(p2)%>%hide_legend(), ggplotly(pp)%>%hide_legend(), titleX=T,titleY=T,margin=0.035,widths=c(0.375,0.425,0.2),which_layout=1) %>% partial_bundle()
```
### maf = 0.40
```{r}
pca=PCA_list$All_unfiltered$maf0.4[[1]]
data_pca=data.frame(INDIV=pca$sample.id,
PC1=pca$eigenvect[,1],
PC2=pca$eigenvect[,2],
PC3=pca$eigenvect[,3],
PC4=pca$eigenvect[,4],
LOCA=c(rep("Algarve",5),
rep("Bay of Biscay",5),
rep("Gulf of Lion",5),
rep("Costa Calida",5)))
color_med_atl=rev(brewer.pal(n=4,name="RdBu"))
p<-ggplot(data=data_pca,aes(x=PC1,y=PC2,label=INDIV))+
theme_minimal()+
theme(panel.grid=element_blank(),
panel.border=element_rect(fill="transparent"),
plot.title=element_text(hjust=0.5))+
geom_hline(yintercept=0,lty=2)+
geom_vline(xintercept=0,lty=2)+
geom_point(size=3,aes(col=LOCA))+
xlab(paste("PCA 1 (",round(pca$varprop[1]*100,2),"% )",sep=""))+
ylab(paste("PCA 2 (",round(pca$varprop[2]*100,2),"% )",sep=""))+
scale_colour_manual(name="Location",
values=c(color_med_atl[2],
color_med_atl[1],
color_med_atl[3],
color_med_atl[4]))
p1<-p
p<-ggplot(data=data_pca,aes(x=PC3,y=PC4,label=INDIV))+
theme_minimal()+
theme(panel.grid=element_blank(),
panel.border=element_rect(fill="transparent"),
plot.title=element_text(hjust=0.5))+
geom_hline(yintercept=0,lty=2)+
geom_vline(xintercept=0,lty=2)+
geom_point(size=3,aes(col=LOCA))+
xlab(paste("PCA 3 (",round(pca$varprop[3]*100,2),"% )",sep=""))+
ylab(paste("PCA 4 (",round(pca$varprop[4]*100,2),"% )",sep=""))+
scale_colour_manual(name="Location",
values=c(color_med_atl[2],
color_med_atl[1],
color_med_atl[3],
color_med_atl[4]))
p2<-p
data_varpop=data.frame(PC=factor(paste("P",seq(1,10),sep=""),levels=paste("P",seq(1,10),sep="")),VAR=pca$varprop[1:10])
pp<-ggplot(data_varpop,aes(x=PC,y=VAR))+
geom_bar(stat='identity',fill="dodgerblue2",alpha=0.25)+
theme_classic()+
xlab("Principal Component")+
ylab("Variation explained (%)")
```
```{r}
subplot(ggplotly(p1)%>% layout(legend = list(orientation = "h", x = 0.2, y =-0.15)), ggplotly(p2)%>%hide_legend(), ggplotly(pp)%>%hide_legend(), titleX=T,titleY=T,margin=0.035,widths=c(0.375,0.425,0.2),which_layout=1) %>% partial_bundle()
```
### maf = 0.45
```{r}
pca=PCA_list$All_unfiltered$maf0.45[[1]]
data_pca=data.frame(INDIV=pca$sample.id,
PC1=pca$eigenvect[,1],
PC2=pca$eigenvect[,2],
PC3=pca$eigenvect[,3],
PC4=pca$eigenvect[,4],
LOCA=c(rep("Algarve",5),
rep("Bay of Biscay",5),
rep("Gulf of Lion",5),
rep("Costa Calida",5)))
color_med_atl=rev(brewer.pal(n=4,name="RdBu"))
p<-ggplot(data=data_pca,aes(x=PC1,y=PC2,label=INDIV))+
theme_minimal()+
theme(panel.grid=element_blank(),
panel.border=element_rect(fill="transparent"),
plot.title=element_text(hjust=0.5))+
geom_hline(yintercept=0,lty=2)+
geom_vline(xintercept=0,lty=2)+
geom_point(size=3,aes(col=LOCA))+
xlab(paste("PCA 1 (",round(pca$varprop[1]*100,2),"% )",sep=""))+
ylab(paste("PCA 2 (",round(pca$varprop[2]*100,2),"% )",sep=""))+
scale_colour_manual(name="Location",
values=c(color_med_atl[2],
color_med_atl[1],
color_med_atl[3],
color_med_atl[4]))
p1<-p
p<-ggplot(data=data_pca,aes(x=PC3,y=PC4,label=INDIV))+
theme_minimal()+
theme(panel.grid=element_blank(),
panel.border=element_rect(fill="transparent"),
plot.title=element_text(hjust=0.5))+
geom_hline(yintercept=0,lty=2)+
geom_vline(xintercept=0,lty=2)+
geom_point(size=3,aes(col=LOCA))+
xlab(paste("PCA 3 (",round(pca$varprop[3]*100,2),"% )",sep=""))+
ylab(paste("PCA 4 (",round(pca$varprop[4]*100,2),"% )",sep=""))+
scale_colour_manual(name="Location",
values=c(color_med_atl[2],
color_med_atl[1],
color_med_atl[3],
color_med_atl[4]))
p2<-p
data_varpop=data.frame(PC=factor(paste("P",seq(1,10),sep=""),levels=paste("P",seq(1,10),sep="")),VAR=pca$varprop[1:10])
pp<-ggplot(data_varpop,aes(x=PC,y=VAR))+
geom_bar(stat='identity',fill="dodgerblue2",alpha=0.25)+
theme_classic()+
xlab("Principal Component")+
ylab("Variation explained (%)")
```
```{r}
subplot(ggplotly(p1)%>% layout(legend = list(orientation = "h", x = 0.2, y =-0.15)), ggplotly(p2)%>%hide_legend(), ggplotly(pp)%>%hide_legend(), titleX=T,titleY=T,margin=0.035,widths=c(0.375,0.425,0.2),which_layout=1) %>% partial_bundle()
```
### maf = 0.50
```{r}
pca=PCA_list$All_unfiltered$maf0.5[[1]]
data_pca=data.frame(INDIV=pca$sample.id,
PC1=pca$eigenvect[,1],
PC2=pca$eigenvect[,2],
PC3=pca$eigenvect[,3],
PC4=pca$eigenvect[,4],
LOCA=c(rep("Algarve",5),
rep("Bay of Biscay",5),
rep("Gulf of Lion",5),
rep("Costa Calida",5)))
color_med_atl=rev(brewer.pal(n=4,name="RdBu"))
p<-ggplot(data=data_pca,aes(x=PC1,y=PC2,label=INDIV))+
theme_minimal()+
theme(panel.grid=element_blank(),
panel.border=element_rect(fill="transparent"),
plot.title=element_text(hjust=0.5))+
geom_hline(yintercept=0,lty=2)+
geom_vline(xintercept=0,lty=2)+
geom_point(size=3,aes(col=LOCA))+
xlab(paste("PCA 1 (",round(pca$varprop[1]*100,2),"% )",sep=""))+
ylab(paste("PCA 2 (",round(pca$varprop[2]*100,2),"% )",sep=""))+
scale_colour_manual(name="Location",
values=c(color_med_atl[2],
color_med_atl[1],
color_med_atl[3],
color_med_atl[4]))
p1<-p
p<-ggplot(data=data_pca,aes(x=PC3,y=PC4,label=INDIV))+
theme_minimal()+
theme(panel.grid=element_blank(),
panel.border=element_rect(fill="transparent"),
plot.title=element_text(hjust=0.5))+
geom_hline(yintercept=0,lty=2)+
geom_vline(xintercept=0,lty=2)+
geom_point(size=3,aes(col=LOCA))+
xlab(paste("PCA 3 (",round(pca$varprop[3]*100,2),"% )",sep=""))+
ylab(paste("PCA 4 (",round(pca$varprop[4]*100,2),"% )",sep=""))+
scale_colour_manual(name="Location",
values=c(color_med_atl[2],
color_med_atl[1],
color_med_atl[3],
color_med_atl[4]))
p2<-p
data_varpop=data.frame(PC=factor(paste("P",seq(1,10),sep=""),levels=paste("P",seq(1,10),sep="")),VAR=pca$varprop[1:10])
pp<-ggplot(data_varpop,aes(x=PC,y=VAR))+
geom_bar(stat='identity',fill="dodgerblue2",alpha=0.25)+
theme_classic()+
xlab("Principal Component")+
ylab("Variation explained (%)")
```
```{r}
subplot(ggplotly(p1)%>% layout(legend = list(orientation = "h", x = 0.2, y =-0.15)), ggplotly(p2)%>%hide_legend(), ggplotly(pp)%>%hide_legend(), titleX=T,titleY=T,margin=0.035,widths=c(0.375,0.425,0.2),which_layout=1) %>% partial_bundle()
```
Row {.tabset data-height=50}
-----------------------
<center>
<font size="6">**Pruned unfiltered SNPS**</font>
</center>
Row {.tabset data-height=600}
-----------------------
### maf = 0
```{r}
pca=PCA_list$Prune_unfiltered$maf0[[1]]
data_pca=data.frame(INDIV=pca$sample.id,
PC1=pca$eigenvect[,1],
PC2=pca$eigenvect[,2],
PC3=pca$eigenvect[,3],
PC4=pca$eigenvect[,4],
LOCA=c(rep("Algarve",5),
rep("Bay of Biscay",5),
rep("Gulf of Lion",5),
rep("Costa Calida",5)))
color_med_atl=rev(brewer.pal(n=4,name="RdBu"))
p<-ggplot(data=data_pca,aes(x=PC1,y=PC2,label=INDIV))+
theme_minimal()+
theme(panel.grid=element_blank(),
panel.border=element_rect(fill="transparent"),
plot.title=element_text(hjust=0.5))+
geom_hline(yintercept=0,lty=2)+
geom_vline(xintercept=0,lty=2)+
geom_point(size=3,aes(col=LOCA))+
xlab(paste("PCA 1 (",round(pca$varprop[1]*100,2),"% )",sep=""))+
ylab(paste("PCA 2 (",round(pca$varprop[2]*100,2),"% )",sep=""))+
scale_colour_manual(name="Location",
values=c(color_med_atl[2],
color_med_atl[1],
color_med_atl[3],
color_med_atl[4]))
p1<-p
p<-ggplot(data=data_pca,aes(x=PC3,y=PC4,label=INDIV))+
theme_minimal()+
theme(panel.grid=element_blank(),
panel.border=element_rect(fill="transparent"),
plot.title=element_text(hjust=0.5))+
geom_hline(yintercept=0,lty=2)+
geom_vline(xintercept=0,lty=2)+
geom_point(size=3,aes(col=LOCA))+
xlab(paste("PCA 3 (",round(pca$varprop[3]*100,2),"% )",sep=""))+
ylab(paste("PCA 4 (",round(pca$varprop[4]*100,2),"% )",sep=""))+
scale_colour_manual(name="Location",
values=c(color_med_atl[2],
color_med_atl[1],
color_med_atl[3],
color_med_atl[4]))
p2<-p
data_varpop=data.frame(PC=factor(paste("P",seq(1,10),sep=""),levels=paste("P",seq(1,10),sep="")),VAR=pca$varprop[1:10])
pp<-ggplot(data_varpop,aes(x=PC,y=VAR))+
geom_bar(stat='identity',fill="dodgerblue2",alpha=0.25)+
theme_classic()+
xlab("Principal Component")+
ylab("Variation explained (%)")
```
```{r}
subplot(ggplotly(p1)%>% layout(legend = list(orientation = "h", x = 0.2, y =-0.15)), ggplotly(p2)%>%hide_legend(), ggplotly(pp)%>%hide_legend(), titleX=T,titleY=T,margin=0.035,widths=c(0.375,0.425,0.2),which_layout=1) %>% partial_bundle()
```
### maf = 0.05
```{r}
pca=PCA_list$Prune_unfiltered$maf0.05[[1]]
data_pca=data.frame(INDIV=pca$sample.id,
PC1=pca$eigenvect[,1],
PC2=pca$eigenvect[,2],
PC3=pca$eigenvect[,3],
PC4=pca$eigenvect[,4],
LOCA=c(rep("Algarve",5),
rep("Bay of Biscay",5),
rep("Gulf of Lion",5),
rep("Costa Calida",5)))
color_med_atl=rev(brewer.pal(n=4,name="RdBu"))
p<-ggplot(data=data_pca,aes(x=PC1,y=PC2,label=INDIV))+
theme_minimal()+
theme(panel.grid=element_blank(),
panel.border=element_rect(fill="transparent"),
plot.title=element_text(hjust=0.5))+
geom_hline(yintercept=0,lty=2)+
geom_vline(xintercept=0,lty=2)+
geom_point(size=3,aes(col=LOCA))+
xlab(paste("PCA 1 (",round(pca$varprop[1]*100,2),"% )",sep=""))+
ylab(paste("PCA 2 (",round(pca$varprop[2]*100,2),"% )",sep=""))+
scale_colour_manual(name="Location",
values=c(color_med_atl[2],
color_med_atl[1],
color_med_atl[3],
color_med_atl[4]))
p1<-p
p<-ggplot(data=data_pca,aes(x=PC3,y=PC4,label=INDIV))+
theme_minimal()+
theme(panel.grid=element_blank(),
panel.border=element_rect(fill="transparent"),
plot.title=element_text(hjust=0.5))+
geom_hline(yintercept=0,lty=2)+
geom_vline(xintercept=0,lty=2)+
geom_point(size=3,aes(col=LOCA))+
xlab(paste("PCA 3 (",round(pca$varprop[3]*100,2),"% )",sep=""))+
ylab(paste("PCA 4 (",round(pca$varprop[4]*100,2),"% )",sep=""))+
scale_colour_manual(name="Location",
values=c(color_med_atl[2],
color_med_atl[1],
color_med_atl[3],
color_med_atl[4]))
p2<-p
data_varpop=data.frame(PC=factor(paste("P",seq(1,10),sep=""),levels=paste("P",seq(1,10),sep="")),VAR=pca$varprop[1:10])
pp<-ggplot(data_varpop,aes(x=PC,y=VAR))+
geom_bar(stat='identity',fill="dodgerblue2",alpha=0.25)+
theme_classic()+
xlab("Principal Component")+
ylab("Variation explained (%)")
```
```{r}
subplot(ggplotly(p1)%>% layout(legend = list(orientation = "h", x = 0.2, y =-0.15)), ggplotly(p2)%>%hide_legend(), ggplotly(pp)%>%hide_legend(), titleX=T,titleY=T,margin=0.035,widths=c(0.375,0.425,0.2),which_layout=1) %>% partial_bundle()
```
### maf = 0.1
```{r}
pca=PCA_list$Prune_unfiltered$maf0.1[[1]]
data_pca=data.frame(INDIV=pca$sample.id,
PC1=pca$eigenvect[,1],
PC2=pca$eigenvect[,2],
PC3=pca$eigenvect[,3],
PC4=pca$eigenvect[,4],
LOCA=c(rep("Algarve",5),
rep("Bay of Biscay",5),
rep("Gulf of Lion",5),
rep("Costa Calida",5)))
color_med_atl=rev(brewer.pal(n=4,name="RdBu"))
p<-ggplot(data=data_pca,aes(x=PC1,y=PC2,label=INDIV))+
theme_minimal()+
theme(panel.grid=element_blank(),
panel.border=element_rect(fill="transparent"),
plot.title=element_text(hjust=0.5))+
geom_hline(yintercept=0,lty=2)+
geom_vline(xintercept=0,lty=2)+
geom_point(size=3,aes(col=LOCA))+
xlab(paste("PCA 1 (",round(pca$varprop[1]*100,2),"% )",sep=""))+
ylab(paste("PCA 2 (",round(pca$varprop[2]*100,2),"% )",sep=""))+
scale_colour_manual(name="Location",
values=c(color_med_atl[2],
color_med_atl[1],
color_med_atl[3],
color_med_atl[4]))
p1<-p
p<-ggplot(data=data_pca,aes(x=PC3,y=PC4,label=INDIV))+
theme_minimal()+
theme(panel.grid=element_blank(),
panel.border=element_rect(fill="transparent"),
plot.title=element_text(hjust=0.5))+
geom_hline(yintercept=0,lty=2)+
geom_vline(xintercept=0,lty=2)+
geom_point(size=3,aes(col=LOCA))+
xlab(paste("PCA 3 (",round(pca$varprop[3]*100,2),"% )",sep=""))+
ylab(paste("PCA 4 (",round(pca$varprop[4]*100,2),"% )",sep=""))+
scale_colour_manual(name="Location",
values=c(color_med_atl[2],
color_med_atl[1],
color_med_atl[3],
color_med_atl[4]))
p2<-p
data_varpop=data.frame(PC=factor(paste("P",seq(1,10),sep=""),levels=paste("P",seq(1,10),sep="")),VAR=pca$varprop[1:10])
pp<-ggplot(data_varpop,aes(x=PC,y=VAR))+
geom_bar(stat='identity',fill="dodgerblue2",alpha=0.25)+
theme_classic()+
xlab("Principal Component")+
ylab("Variation explained (%)")
```
```{r}
subplot(ggplotly(p1)%>% layout(legend = list(orientation = "h", x = 0.2, y =-0.15)), ggplotly(p2)%>%hide_legend(), ggplotly(pp)%>%hide_legend(), titleX=T,titleY=T,margin=0.035,widths=c(0.375,0.425,0.2),which_layout=1) %>% partial_bundle()
```
### maf = 0.15
```{r}
pca=PCA_list$Prune_unfiltered$maf0.15[[1]]
data_pca=data.frame(INDIV=pca$sample.id,
PC1=pca$eigenvect[,1],
PC2=pca$eigenvect[,2],
PC3=pca$eigenvect[,3],
PC4=pca$eigenvect[,4],
LOCA=c(rep("Algarve",5),
rep("Bay of Biscay",5),
rep("Gulf of Lion",5),
rep("Costa Calida",5)))
color_med_atl=rev(brewer.pal(n=4,name="RdBu"))
p<-ggplot(data=data_pca,aes(x=PC1,y=PC2,label=INDIV))+
theme_minimal()+
theme(panel.grid=element_blank(),
panel.border=element_rect(fill="transparent"),
plot.title=element_text(hjust=0.5))+
geom_hline(yintercept=0,lty=2)+
geom_vline(xintercept=0,lty=2)+
geom_point(size=3,aes(col=LOCA))+
xlab(paste("PCA 1 (",round(pca$varprop[1]*100,2),"% )",sep=""))+
ylab(paste("PCA 2 (",round(pca$varprop[2]*100,2),"% )",sep=""))+
scale_colour_manual(name="Location",
values=c(color_med_atl[2],
color_med_atl[1],
color_med_atl[3],
color_med_atl[4]))
p1<-p
p<-ggplot(data=data_pca,aes(x=PC3,y=PC4,label=INDIV))+
theme_minimal()+
theme(panel.grid=element_blank(),
panel.border=element_rect(fill="transparent"),
plot.title=element_text(hjust=0.5))+
geom_hline(yintercept=0,lty=2)+
geom_vline(xintercept=0,lty=2)+
geom_point(size=3,aes(col=LOCA))+
xlab(paste("PCA 3 (",round(pca$varprop[3]*100,2),"% )",sep=""))+
ylab(paste("PCA 4 (",round(pca$varprop[4]*100,2),"% )",sep=""))+
scale_colour_manual(name="Location",
values=c(color_med_atl[2],
color_med_atl[1],
color_med_atl[3],
color_med_atl[4]))
p2<-p
data_varpop=data.frame(PC=factor(paste("P",seq(1,10),sep=""),levels=paste("P",seq(1,10),sep="")),VAR=pca$varprop[1:10])
pp<-ggplot(data_varpop,aes(x=PC,y=VAR))+
geom_bar(stat='identity',fill="dodgerblue2",alpha=0.25)+
theme_classic()+
xlab("Principal Component")+
ylab("Variation explained (%)")
```
```{r}
subplot(ggplotly(p1)%>% layout(legend = list(orientation = "h", x = 0.2, y =-0.15)), ggplotly(p2)%>%hide_legend(), ggplotly(pp)%>%hide_legend(), titleX=T,titleY=T,margin=0.035,widths=c(0.375,0.425,0.2),which_layout=1) %>% partial_bundle()
```
### maf = 0.20
```{r}
pca=PCA_list$Prune_unfiltered$maf0.2[[1]]
data_pca=data.frame(INDIV=pca$sample.id,
PC1=pca$eigenvect[,1],
PC2=pca$eigenvect[,2],
PC3=pca$eigenvect[,3],
PC4=pca$eigenvect[,4],
LOCA=c(rep("Algarve",5),
rep("Bay of Biscay",5),
rep("Gulf of Lion",5),
rep("Costa Calida",5)))
color_med_atl=rev(brewer.pal(n=4,name="RdBu"))
p<-ggplot(data=data_pca,aes(x=PC1,y=PC2,label=INDIV))+
theme_minimal()+
theme(panel.grid=element_blank(),
panel.border=element_rect(fill="transparent"),
plot.title=element_text(hjust=0.5))+
geom_hline(yintercept=0,lty=2)+
geom_vline(xintercept=0,lty=2)+
geom_point(size=3,aes(col=LOCA))+
xlab(paste("PCA 1 (",round(pca$varprop[1]*100,2),"% )",sep=""))+
ylab(paste("PCA 2 (",round(pca$varprop[2]*100,2),"% )",sep=""))+
scale_colour_manual(name="Location",
values=c(color_med_atl[2],
color_med_atl[1],
color_med_atl[3],
color_med_atl[4]))
p1<-p
p<-ggplot(data=data_pca,aes(x=PC3,y=PC4,label=INDIV))+
theme_minimal()+
theme(panel.grid=element_blank(),
panel.border=element_rect(fill="transparent"),
plot.title=element_text(hjust=0.5))+
geom_hline(yintercept=0,lty=2)+
geom_vline(xintercept=0,lty=2)+
geom_point(size=3,aes(col=LOCA))+
xlab(paste("PCA 3 (",round(pca$varprop[3]*100,2),"% )",sep=""))+
ylab(paste("PCA 4 (",round(pca$varprop[4]*100,2),"% )",sep=""))+
scale_colour_manual(name="Location",
values=c(color_med_atl[2],
color_med_atl[1],
color_med_atl[3],
color_med_atl[4]))
p2<-p
data_varpop=data.frame(PC=factor(paste("P",seq(1,10),sep=""),levels=paste("P",seq(1,10),sep="")),VAR=pca$varprop[1:10])
pp<-ggplot(data_varpop,aes(x=PC,y=VAR))+
geom_bar(stat='identity',fill="dodgerblue2",alpha=0.25)+
theme_classic()+
xlab("Principal Component")+
ylab("Variation explained (%)")
```
```{r}
subplot(ggplotly(p1)%>% layout(legend = list(orientation = "h", x = 0.2, y =-0.15)), ggplotly(p2)%>%hide_legend(), ggplotly(pp)%>%hide_legend(), titleX=T,titleY=T,margin=0.035,widths=c(0.375,0.425,0.2),which_layout=1) %>% partial_bundle()
```
### maf = 0.25
```{r}
pca=PCA_list$Prune_unfiltered$maf0.25[[1]]
data_pca=data.frame(INDIV=pca$sample.id,
PC1=pca$eigenvect[,1],
PC2=pca$eigenvect[,2],
PC3=pca$eigenvect[,3],
PC4=pca$eigenvect[,4],
LOCA=c(rep("Algarve",5),
rep("Bay of Biscay",5),
rep("Gulf of Lion",5),
rep("Costa Calida",5)))
color_med_atl=rev(brewer.pal(n=4,name="RdBu"))
p<-ggplot(data=data_pca,aes(x=PC1,y=PC2,label=INDIV))+
theme_minimal()+
theme(panel.grid=element_blank(),
panel.border=element_rect(fill="transparent"),
plot.title=element_text(hjust=0.5))+
geom_hline(yintercept=0,lty=2)+
geom_vline(xintercept=0,lty=2)+
geom_point(size=3,aes(col=LOCA))+
xlab(paste("PCA 1 (",round(pca$varprop[1]*100,2),"% )",sep=""))+
ylab(paste("PCA 2 (",round(pca$varprop[2]*100,2),"% )",sep=""))+
scale_colour_manual(name="Location",
values=c(color_med_atl[2],
color_med_atl[1],
color_med_atl[3],
color_med_atl[4]))
p1<-p
p<-ggplot(data=data_pca,aes(x=PC3,y=PC4,label=INDIV))+
theme_minimal()+
theme(panel.grid=element_blank(),
panel.border=element_rect(fill="transparent"),
plot.title=element_text(hjust=0.5))+
geom_hline(yintercept=0,lty=2)+
geom_vline(xintercept=0,lty=2)+
geom_point(size=3,aes(col=LOCA))+
xlab(paste("PCA 3 (",round(pca$varprop[3]*100,2),"% )",sep=""))+
ylab(paste("PCA 4 (",round(pca$varprop[4]*100,2),"% )",sep=""))+
scale_colour_manual(name="Location",
values=c(color_med_atl[2],
color_med_atl[1],
color_med_atl[3],
color_med_atl[4]))
p2<-p
data_varpop=data.frame(PC=factor(paste("P",seq(1,10),sep=""),levels=paste("P",seq(1,10),sep="")),VAR=pca$varprop[1:10])
pp<-ggplot(data_varpop,aes(x=PC,y=VAR))+
geom_bar(stat='identity',fill="dodgerblue2",alpha=0.25)+
theme_classic()+
xlab("Principal Component")+
ylab("Variation explained (%)")
```
```{r}
subplot(ggplotly(p1)%>% layout(legend = list(orientation = "h", x = 0.2, y =-0.15)), ggplotly(p2)%>%hide_legend(), ggplotly(pp)%>%hide_legend(), titleX=T,titleY=T,margin=0.035,widths=c(0.375,0.425,0.2),which_layout=1) %>% partial_bundle()
```
### maf = 0.30
```{r}
pca=PCA_list$Prune_unfiltered$maf0.3[[1]]
data_pca=data.frame(INDIV=pca$sample.id,
PC1=pca$eigenvect[,1],
PC2=pca$eigenvect[,2],
PC3=pca$eigenvect[,3],
PC4=pca$eigenvect[,4],
LOCA=c(rep("Algarve",5),
rep("Bay of Biscay",5),
rep("Gulf of Lion",5),
rep("Costa Calida",5)))
color_med_atl=rev(brewer.pal(n=4,name="RdBu"))
p<-ggplot(data=data_pca,aes(x=PC1,y=PC2,label=INDIV))+
theme_minimal()+
theme(panel.grid=element_blank(),
panel.border=element_rect(fill="transparent"),
plot.title=element_text(hjust=0.5))+
geom_hline(yintercept=0,lty=2)+
geom_vline(xintercept=0,lty=2)+
geom_point(size=3,aes(col=LOCA))+
xlab(paste("PCA 1 (",round(pca$varprop[1]*100,2),"% )",sep=""))+
ylab(paste("PCA 2 (",round(pca$varprop[2]*100,2),"% )",sep=""))+
scale_colour_manual(name="Location",
values=c(color_med_atl[2],
color_med_atl[1],
color_med_atl[3],
color_med_atl[4]))
p1<-p
p<-ggplot(data=data_pca,aes(x=PC3,y=PC4,label=INDIV))+
theme_minimal()+
theme(panel.grid=element_blank(),
panel.border=element_rect(fill="transparent"),
plot.title=element_text(hjust=0.5))+
geom_hline(yintercept=0,lty=2)+
geom_vline(xintercept=0,lty=2)+
geom_point(size=3,aes(col=LOCA))+
xlab(paste("PCA 3 (",round(pca$varprop[3]*100,2),"% )",sep=""))+
ylab(paste("PCA 4 (",round(pca$varprop[4]*100,2),"% )",sep=""))+
scale_colour_manual(name="Location",
values=c(color_med_atl[2],
color_med_atl[1],
color_med_atl[3],
color_med_atl[4]))
p2<-p
data_varpop=data.frame(PC=factor(paste("P",seq(1,10),sep=""),levels=paste("P",seq(1,10),sep="")),VAR=pca$varprop[1:10])
pp<-ggplot(data_varpop,aes(x=PC,y=VAR))+
geom_bar(stat='identity',fill="dodgerblue2",alpha=0.25)+
theme_classic()+
xlab("Principal Component")+
ylab("Variation explained (%)")
```
```{r}
subplot(ggplotly(p1)%>% layout(legend = list(orientation = "h", x = 0.2, y =-0.15)), ggplotly(p2)%>%hide_legend(), ggplotly(pp)%>%hide_legend(), titleX=T,titleY=T,margin=0.035,widths=c(0.375,0.425,0.2),which_layout=1) %>% partial_bundle()
```
### maf = 0.35
```{r}
pca=PCA_list$Prune_unfiltered$maf0.35[[1]]
data_pca=data.frame(INDIV=pca$sample.id,
PC1=pca$eigenvect[,1],
PC2=pca$eigenvect[,2],
PC3=pca$eigenvect[,3],
PC4=pca$eigenvect[,4],
LOCA=c(rep("Algarve",5),
rep("Bay of Biscay",5),
rep("Gulf of Lion",5),
rep("Costa Calida",5)))
color_med_atl=rev(brewer.pal(n=4,name="RdBu"))
p<-ggplot(data=data_pca,aes(x=PC1,y=PC2,label=INDIV))+
theme_minimal()+
theme(panel.grid=element_blank(),
panel.border=element_rect(fill="transparent"),
plot.title=element_text(hjust=0.5))+
geom_hline(yintercept=0,lty=2)+
geom_vline(xintercept=0,lty=2)+
geom_point(size=3,aes(col=LOCA))+
xlab(paste("PCA 1 (",round(pca$varprop[1]*100,2),"% )",sep=""))+
ylab(paste("PCA 2 (",round(pca$varprop[2]*100,2),"% )",sep=""))+
scale_colour_manual(name="Location",
values=c(color_med_atl[2],
color_med_atl[1],
color_med_atl[3],
color_med_atl[4]))
p1<-p
p<-ggplot(data=data_pca,aes(x=PC3,y=PC4,label=INDIV))+
theme_minimal()+
theme(panel.grid=element_blank(),
panel.border=element_rect(fill="transparent"),
plot.title=element_text(hjust=0.5))+
geom_hline(yintercept=0,lty=2)+
geom_vline(xintercept=0,lty=2)+
geom_point(size=3,aes(col=LOCA))+
xlab(paste("PCA 3 (",round(pca$varprop[3]*100,2),"% )",sep=""))+
ylab(paste("PCA 4 (",round(pca$varprop[4]*100,2),"% )",sep=""))+
scale_colour_manual(name="Location",
values=c(color_med_atl[2],
color_med_atl[1],
color_med_atl[3],
color_med_atl[4]))
p2<-p
data_varpop=data.frame(PC=factor(paste("P",seq(1,10),sep=""),levels=paste("P",seq(1,10),sep="")),VAR=pca$varprop[1:10])
pp<-ggplot(data_varpop,aes(x=PC,y=VAR))+
geom_bar(stat='identity',fill="dodgerblue2",alpha=0.25)+
theme_classic()+
xlab("Principal Component")+
ylab("Variation explained (%)")
```
```{r}
subplot(ggplotly(p1)%>% layout(legend = list(orientation = "h", x = 0.2, y =-0.15)), ggplotly(p2)%>%hide_legend(), ggplotly(pp)%>%hide_legend(), titleX=T,titleY=T,margin=0.035,widths=c(0.375,0.425,0.2),which_layout=1) %>% partial_bundle()
```
### maf = 0.40
```{r}
pca=PCA_list$Prune_unfiltered$maf0.4[[1]]
data_pca=data.frame(INDIV=pca$sample.id,
PC1=pca$eigenvect[,1],
PC2=pca$eigenvect[,2],
PC3=pca$eigenvect[,3],
PC4=pca$eigenvect[,4],
LOCA=c(rep("Algarve",5),
rep("Bay of Biscay",5),
rep("Gulf of Lion",5),
rep("Costa Calida",5)))
color_med_atl=rev(brewer.pal(n=4,name="RdBu"))
p<-ggplot(data=data_pca,aes(x=PC1,y=PC2,label=INDIV))+
theme_minimal()+
theme(panel.grid=element_blank(),
panel.border=element_rect(fill="transparent"),
plot.title=element_text(hjust=0.5))+
geom_hline(yintercept=0,lty=2)+
geom_vline(xintercept=0,lty=2)+
geom_point(size=3,aes(col=LOCA))+
xlab(paste("PCA 1 (",round(pca$varprop[1]*100,2),"% )",sep=""))+
ylab(paste("PCA 2 (",round(pca$varprop[2]*100,2),"% )",sep=""))+
scale_colour_manual(name="Location",
values=c(color_med_atl[2],
color_med_atl[1],
color_med_atl[3],
color_med_atl[4]))
p1<-p
p<-ggplot(data=data_pca,aes(x=PC3,y=PC4,label=INDIV))+
theme_minimal()+
theme(panel.grid=element_blank(),
panel.border=element_rect(fill="transparent"),
plot.title=element_text(hjust=0.5))+
geom_hline(yintercept=0,lty=2)+
geom_vline(xintercept=0,lty=2)+
geom_point(size=3,aes(col=LOCA))+
xlab(paste("PCA 3 (",round(pca$varprop[3]*100,2),"% )",sep=""))+
ylab(paste("PCA 4 (",round(pca$varprop[4]*100,2),"% )",sep=""))+
scale_colour_manual(name="Location",
values=c(color_med_atl[2],
color_med_atl[1],
color_med_atl[3],
color_med_atl[4]))
p2<-p
data_varpop=data.frame(PC=factor(paste("P",seq(1,10),sep=""),levels=paste("P",seq(1,10),sep="")),VAR=pca$varprop[1:10])
pp<-ggplot(data_varpop,aes(x=PC,y=VAR))+
geom_bar(stat='identity',fill="dodgerblue2",alpha=0.25)+
theme_classic()+
xlab("Principal Component")+
ylab("Variation explained (%)")
```
```{r}
subplot(ggplotly(p1)%>% layout(legend = list(orientation = "h", x = 0.2, y =-0.15)), ggplotly(p2)%>%hide_legend(), ggplotly(pp)%>%hide_legend(), titleX=T,titleY=T,margin=0.035,widths=c(0.375,0.425,0.2),which_layout=1) %>% partial_bundle()
```
### maf = 0.45
```{r}
pca=PCA_list$Prune_unfiltered$maf0.45[[1]]
data_pca=data.frame(INDIV=pca$sample.id,
PC1=pca$eigenvect[,1],
PC2=pca$eigenvect[,2],
PC3=pca$eigenvect[,3],
PC4=pca$eigenvect[,4],
LOCA=c(rep("Algarve",5),
rep("Bay of Biscay",5),
rep("Gulf of Lion",5),
rep("Costa Calida",5)))
color_med_atl=rev(brewer.pal(n=4,name="RdBu"))
p<-ggplot(data=data_pca,aes(x=PC1,y=PC2,label=INDIV))+
theme_minimal()+
theme(panel.grid=element_blank(),
panel.border=element_rect(fill="transparent"),
plot.title=element_text(hjust=0.5))+
geom_hline(yintercept=0,lty=2)+
geom_vline(xintercept=0,lty=2)+
geom_point(size=3,aes(col=LOCA))+
xlab(paste("PCA 1 (",round(pca$varprop[1]*100,2),"% )",sep=""))+
ylab(paste("PCA 2 (",round(pca$varprop[2]*100,2),"% )",sep=""))+
scale_colour_manual(name="Location",
values=c(color_med_atl[2],
color_med_atl[1],
color_med_atl[3],
color_med_atl[4]))
p1<-p
p<-ggplot(data=data_pca,aes(x=PC3,y=PC4,label=INDIV))+
theme_minimal()+
theme(panel.grid=element_blank(),
panel.border=element_rect(fill="transparent"),
plot.title=element_text(hjust=0.5))+
geom_hline(yintercept=0,lty=2)+
geom_vline(xintercept=0,lty=2)+
geom_point(size=3,aes(col=LOCA))+
xlab(paste("PCA 3 (",round(pca$varprop[3]*100,2),"% )",sep=""))+
ylab(paste("PCA 4 (",round(pca$varprop[4]*100,2),"% )",sep=""))+
scale_colour_manual(name="Location",
values=c(color_med_atl[2],
color_med_atl[1],
color_med_atl[3],
color_med_atl[4]))
p2<-p
data_varpop=data.frame(PC=factor(paste("P",seq(1,10),sep=""),levels=paste("P",seq(1,10),sep="")),VAR=pca$varprop[1:10])
pp<-ggplot(data_varpop,aes(x=PC,y=VAR))+
geom_bar(stat='identity',fill="dodgerblue2",alpha=0.25)+
theme_classic()+
xlab("Principal Component")+
ylab("Variation explained (%)")
```
```{r}
subplot(ggplotly(p1)%>% layout(legend = list(orientation = "h", x = 0.2, y =-0.15)), ggplotly(p2)%>%hide_legend(), ggplotly(pp)%>%hide_legend(), titleX=T,titleY=T,margin=0.035,widths=c(0.375,0.425,0.2),which_layout=1) %>% partial_bundle()
```
### maf = 0.50
```{r}
pca=PCA_list$Prune_unfiltered$maf0.5[[1]]
data_pca=data.frame(INDIV=pca$sample.id,
PC1=pca$eigenvect[,1],
PC2=pca$eigenvect[,2],
PC3=pca$eigenvect[,3],
PC4=pca$eigenvect[,4],
LOCA=c(rep("Algarve",5),
rep("Bay of Biscay",5),
rep("Gulf of Lion",5),
rep("Costa Calida",5)))
color_med_atl=rev(brewer.pal(n=4,name="RdBu"))
p<-ggplot(data=data_pca,aes(x=PC1,y=PC2,label=INDIV))+
theme_minimal()+
theme(panel.grid=element_blank(),
panel.border=element_rect(fill="transparent"),
plot.title=element_text(hjust=0.5))+
geom_hline(yintercept=0,lty=2)+
geom_vline(xintercept=0,lty=2)+
geom_point(size=3,aes(col=LOCA))+
xlab(paste("PCA 1 (",round(pca$varprop[1]*100,2),"% )",sep=""))+
ylab(paste("PCA 2 (",round(pca$varprop[2]*100,2),"% )",sep=""))+
scale_colour_manual(name="Location",
values=c(color_med_atl[2],
color_med_atl[1],
color_med_atl[3],
color_med_atl[4]))
p1<-p
p<-ggplot(data=data_pca,aes(x=PC3,y=PC4,label=INDIV))+
theme_minimal()+
theme(panel.grid=element_blank(),
panel.border=element_rect(fill="transparent"),
plot.title=element_text(hjust=0.5))+
geom_hline(yintercept=0,lty=2)+
geom_vline(xintercept=0,lty=2)+
geom_point(size=3,aes(col=LOCA))+
xlab(paste("PCA 3 (",round(pca$varprop[3]*100,2),"% )",sep=""))+
ylab(paste("PCA 4 (",round(pca$varprop[4]*100,2),"% )",sep=""))+
scale_colour_manual(name="Location",
values=c(color_med_atl[2],
color_med_atl[1],
color_med_atl[3],
color_med_atl[4]))
p2<-p
data_varpop=data.frame(PC=factor(paste("P",seq(1,10),sep=""),levels=paste("P",seq(1,10),sep="")),VAR=pca$varprop[1:10])
pp<-ggplot(data_varpop,aes(x=PC,y=VAR))+
geom_bar(stat='identity',fill="dodgerblue2",alpha=0.25)+
theme_classic()+
xlab("Principal Component")+
ylab("Variation explained (%)")
```
```{r}
subplot(ggplotly(p1)%>% layout(legend = list(orientation = "h", x = 0.2, y =-0.15)), ggplotly(p2)%>%hide_legend(), ggplotly(pp)%>%hide_legend(), titleX=T,titleY=T,margin=0.035,widths=c(0.375,0.425,0.2),which_layout=1) %>% partial_bundle()
```
Dicentrarchus labrax {data-navmenu="Species"}
=======================================================================
```{r, include = FALSE}
load(file = paste(path,"/output/pca/Dlabr_PCA_list.Rdata",sep=""))
```
Row {.tabset data-height=100}
-----------------------
<center>
<font size="6">**Dicentrarchus labrax**</font>
</center>
Row {.tabset data-height=50}
-----------------------
<center>
<font size="6">**All filtered SNPS**</font>
</center>
Row {.tabset data-height=600}
-----------------------
### maf = 0
```{r}
pca=PCA_list$All_filtered$maf0[[1]]
data_pca=data.frame(INDIV=pca$sample.id,
PC1=pca$eigenvect[,1],
PC2=pca$eigenvect[,2],
PC3=pca$eigenvect[,3],
PC4=pca$eigenvect[,4],
LOCA=c(rep("Algarve",5),
rep("Bay of Biscay",5),
rep("Gulf of Lion",5),
rep("Costa Calida",5)))
color_med_atl=rev(brewer.pal(n=4,name="RdBu"))
p<-ggplot(data=data_pca,aes(x=PC1,y=PC2,label=INDIV))+
theme_minimal()+
theme(panel.grid=element_blank(),
panel.border=element_rect(fill="transparent"),
plot.title=element_text(hjust=0.5))+
geom_hline(yintercept=0,lty=2)+
geom_vline(xintercept=0,lty=2)+
geom_point(size=3,aes(col=LOCA))+
xlab(paste("PCA 1 (",round(pca$varprop[1]*100,2),"% )",sep=""))+
ylab(paste("PCA 2 (",round(pca$varprop[2]*100,2),"% )",sep=""))+
scale_colour_manual(name="Location",
values=c(color_med_atl[2],
color_med_atl[1],
color_med_atl[3],
color_med_atl[4]))
p1<-p
p<-ggplot(data=data_pca,aes(x=PC3,y=PC4,label=INDIV))+
theme_minimal()+
theme(panel.grid=element_blank(),
panel.border=element_rect(fill="transparent"),
plot.title=element_text(hjust=0.5))+
geom_hline(yintercept=0,lty=2)+
geom_vline(xintercept=0,lty=2)+
geom_point(size=3,aes(col=LOCA))+
xlab(paste("PCA 3 (",round(pca$varprop[3]*100,2),"% )",sep=""))+
ylab(paste("PCA 4 (",round(pca$varprop[4]*100,2),"% )",sep=""))+
scale_colour_manual(name="Location",
values=c(color_med_atl[2],
color_med_atl[1],
color_med_atl[3],
color_med_atl[4]))
p2<-p
data_varpop=data.frame(PC=factor(paste("P",seq(1,10),sep=""),levels=paste("P",seq(1,10),sep="")),VAR=pca$varprop[1:10])
pp<-ggplot(data_varpop,aes(x=PC,y=VAR))+
geom_bar(stat='identity',fill="dodgerblue2",alpha=0.25)+
theme_classic()+
xlab("Principal Component")+
ylab("Variation explained (%)")
```
```{r}
subplot(ggplotly(p1)%>% layout(legend = list(orientation = "h", x = 0.2, y =-0.15)), ggplotly(p2)%>%hide_legend(), ggplotly(pp)%>%hide_legend(), titleX=T,titleY=T,margin=0.035,widths=c(0.375,0.425,0.2),which_layout=1) %>% partial_bundle()
```
### maf = 0.05
```{r}
pca=PCA_list$All_filtered$maf0.05[[1]]
data_pca=data.frame(INDIV=pca$sample.id,
PC1=pca$eigenvect[,1],
PC2=pca$eigenvect[,2],
PC3=pca$eigenvect[,3],
PC4=pca$eigenvect[,4],
LOCA=c(rep("Algarve",5),
rep("Bay of Biscay",5),
rep("Gulf of Lion",5),
rep("Costa Calida",5)))
color_med_atl=rev(brewer.pal(n=4,name="RdBu"))
p<-ggplot(data=data_pca,aes(x=PC1,y=PC2,label=INDIV))+
theme_minimal()+
theme(panel.grid=element_blank(),
panel.border=element_rect(fill="transparent"),
plot.title=element_text(hjust=0.5))+
geom_hline(yintercept=0,lty=2)+
geom_vline(xintercept=0,lty=2)+
geom_point(size=3,aes(col=LOCA))+
xlab(paste("PCA 1 (",round(pca$varprop[1]*100,2),"% )",sep=""))+
ylab(paste("PCA 2 (",round(pca$varprop[2]*100,2),"% )",sep=""))+
scale_colour_manual(name="Location",
values=c(color_med_atl[2],
color_med_atl[1],
color_med_atl[3],
color_med_atl[4]))
p1<-p
p<-ggplot(data=data_pca,aes(x=PC3,y=PC4,label=INDIV))+
theme_minimal()+
theme(panel.grid=element_blank(),
panel.border=element_rect(fill="transparent"),
plot.title=element_text(hjust=0.5))+
geom_hline(yintercept=0,lty=2)+
geom_vline(xintercept=0,lty=2)+
geom_point(size=3,aes(col=LOCA))+
xlab(paste("PCA 3 (",round(pca$varprop[3]*100,2),"% )",sep=""))+
ylab(paste("PCA 4 (",round(pca$varprop[4]*100,2),"% )",sep=""))+
scale_colour_manual(name="Location",
values=c(color_med_atl[2],
color_med_atl[1],
color_med_atl[3],
color_med_atl[4]))
p2<-p
data_varpop=data.frame(PC=factor(paste("P",seq(1,10),sep=""),levels=paste("P",seq(1,10),sep="")),VAR=pca$varprop[1:10])
pp<-ggplot(data_varpop,aes(x=PC,y=VAR))+
geom_bar(stat='identity',fill="dodgerblue2",alpha=0.25)+
theme_classic()+
xlab("Principal Component")+
ylab("Variation explained (%)")
```
```{r}
subplot(ggplotly(p1)%>% layout(legend = list(orientation = "h", x = 0.2, y =-0.15)), ggplotly(p2)%>%hide_legend(), ggplotly(pp)%>%hide_legend(), titleX=T,titleY=T,margin=0.035,widths=c(0.375,0.425,0.2),which_layout=1) %>% partial_bundle()
```
### maf = 0.1
```{r}
pca=PCA_list$All_filtered$maf0.1[[1]]
data_pca=data.frame(INDIV=pca$sample.id,
PC1=pca$eigenvect[,1],
PC2=pca$eigenvect[,2],
PC3=pca$eigenvect[,3],
PC4=pca$eigenvect[,4],
LOCA=c(rep("Algarve",5),
rep("Bay of Biscay",5),
rep("Gulf of Lion",5),
rep("Costa Calida",5)))
color_med_atl=rev(brewer.pal(n=4,name="RdBu"))
p<-ggplot(data=data_pca,aes(x=PC1,y=PC2,label=INDIV))+
theme_minimal()+
theme(panel.grid=element_blank(),
panel.border=element_rect(fill="transparent"),
plot.title=element_text(hjust=0.5))+
geom_hline(yintercept=0,lty=2)+
geom_vline(xintercept=0,lty=2)+
geom_point(size=3,aes(col=LOCA))+
xlab(paste("PCA 1 (",round(pca$varprop[1]*100,2),"% )",sep=""))+
ylab(paste("PCA 2 (",round(pca$varprop[2]*100,2),"% )",sep=""))+
scale_colour_manual(name="Location",
values=c(color_med_atl[2],
color_med_atl[1],
color_med_atl[3],
color_med_atl[4]))
p1<-p
p<-ggplot(data=data_pca,aes(x=PC3,y=PC4,label=INDIV))+
theme_minimal()+
theme(panel.grid=element_blank(),
panel.border=element_rect(fill="transparent"),
plot.title=element_text(hjust=0.5))+
geom_hline(yintercept=0,lty=2)+
geom_vline(xintercept=0,lty=2)+
geom_point(size=3,aes(col=LOCA))+
xlab(paste("PCA 3 (",round(pca$varprop[3]*100,2),"% )",sep=""))+
ylab(paste("PCA 4 (",round(pca$varprop[4]*100,2),"% )",sep=""))+
scale_colour_manual(name="Location",
values=c(color_med_atl[2],
color_med_atl[1],
color_med_atl[3],
color_med_atl[4]))
p2<-p
data_varpop=data.frame(PC=factor(paste("P",seq(1,10),sep=""),levels=paste("P",seq(1,10),sep="")),VAR=pca$varprop[1:10])
pp<-ggplot(data_varpop,aes(x=PC,y=VAR))+
geom_bar(stat='identity',fill="dodgerblue2",alpha=0.25)+
theme_classic()+
xlab("Principal Component")+
ylab("Variation explained (%)")
```
```{r}
subplot(ggplotly(p1)%>% layout(legend = list(orientation = "h", x = 0.2, y =-0.15)), ggplotly(p2)%>%hide_legend(), ggplotly(pp)%>%hide_legend(), titleX=T,titleY=T,margin=0.035,widths=c(0.375,0.425,0.2),which_layout=1) %>% partial_bundle()
```
### maf = 0.15
```{r}
pca=PCA_list$All_filtered$maf0.15[[1]]
data_pca=data.frame(INDIV=pca$sample.id,
PC1=pca$eigenvect[,1],
PC2=pca$eigenvect[,2],
PC3=pca$eigenvect[,3],
PC4=pca$eigenvect[,4],
LOCA=c(rep("Algarve",5),
rep("Bay of Biscay",5),
rep("Gulf of Lion",5),
rep("Costa Calida",5)))
color_med_atl=rev(brewer.pal(n=4,name="RdBu"))
p<-ggplot(data=data_pca,aes(x=PC1,y=PC2,label=INDIV))+
theme_minimal()+
theme(panel.grid=element_blank(),
panel.border=element_rect(fill="transparent"),
plot.title=element_text(hjust=0.5))+
geom_hline(yintercept=0,lty=2)+
geom_vline(xintercept=0,lty=2)+
geom_point(size=3,aes(col=LOCA))+
xlab(paste("PCA 1 (",round(pca$varprop[1]*100,2),"% )",sep=""))+
ylab(paste("PCA 2 (",round(pca$varprop[2]*100,2),"% )",sep=""))+
scale_colour_manual(name="Location",
values=c(color_med_atl[2],
color_med_atl[1],
color_med_atl[3],
color_med_atl[4]))
p1<-p
p<-ggplot(data=data_pca,aes(x=PC3,y=PC4,label=INDIV))+
theme_minimal()+
theme(panel.grid=element_blank(),
panel.border=element_rect(fill="transparent"),
plot.title=element_text(hjust=0.5))+
geom_hline(yintercept=0,lty=2)+
geom_vline(xintercept=0,lty=2)+
geom_point(size=3,aes(col=LOCA))+
xlab(paste("PCA 3 (",round(pca$varprop[3]*100,2),"% )",sep=""))+
ylab(paste("PCA 4 (",round(pca$varprop[4]*100,2),"% )",sep=""))+
scale_colour_manual(name="Location",
values=c(color_med_atl[2],
color_med_atl[1],
color_med_atl[3],
color_med_atl[4]))
p2<-p
data_varpop=data.frame(PC=factor(paste("P",seq(1,10),sep=""),levels=paste("P",seq(1,10),sep="")),VAR=pca$varprop[1:10])
pp<-ggplot(data_varpop,aes(x=PC,y=VAR))+
geom_bar(stat='identity',fill="dodgerblue2",alpha=0.25)+
theme_classic()+
xlab("Principal Component")+
ylab("Variation explained (%)")
```
```{r}
subplot(ggplotly(p1)%>% layout(legend = list(orientation = "h", x = 0.2, y =-0.15)), ggplotly(p2)%>%hide_legend(), ggplotly(pp)%>%hide_legend(), titleX=T,titleY=T,margin=0.035,widths=c(0.375,0.425,0.2),which_layout=1) %>% partial_bundle()
```
### maf = 0.20
```{r}
pca=PCA_list$All_filtered$maf0.2[[1]]
data_pca=data.frame(INDIV=pca$sample.id,
PC1=pca$eigenvect[,1],
PC2=pca$eigenvect[,2],
PC3=pca$eigenvect[,3],
PC4=pca$eigenvect[,4],
LOCA=c(rep("Algarve",5),
rep("Bay of Biscay",5),
rep("Gulf of Lion",5),
rep("Costa Calida",5)))
color_med_atl=rev(brewer.pal(n=4,name="RdBu"))
p<-ggplot(data=data_pca,aes(x=PC1,y=PC2,label=INDIV))+
theme_minimal()+
theme(panel.grid=element_blank(),
panel.border=element_rect(fill="transparent"),
plot.title=element_text(hjust=0.5))+
geom_hline(yintercept=0,lty=2)+
geom_vline(xintercept=0,lty=2)+
geom_point(size=3,aes(col=LOCA))+
xlab(paste("PCA 1 (",round(pca$varprop[1]*100,2),"% )",sep=""))+
ylab(paste("PCA 2 (",round(pca$varprop[2]*100,2),"% )",sep=""))+
scale_colour_manual(name="Location",
values=c(color_med_atl[2],
color_med_atl[1],
color_med_atl[3],
color_med_atl[4]))
p1<-p
p<-ggplot(data=data_pca,aes(x=PC3,y=PC4,label=INDIV))+
theme_minimal()+
theme(panel.grid=element_blank(),
panel.border=element_rect(fill="transparent"),
plot.title=element_text(hjust=0.5))+
geom_hline(yintercept=0,lty=2)+
geom_vline(xintercept=0,lty=2)+
geom_point(size=3,aes(col=LOCA))+
xlab(paste("PCA 3 (",round(pca$varprop[3]*100,2),"% )",sep=""))+
ylab(paste("PCA 4 (",round(pca$varprop[4]*100,2),"% )",sep=""))+
scale_colour_manual(name="Location",
values=c(color_med_atl[2],
color_med_atl[1],
color_med_atl[3],
color_med_atl[4]))
p2<-p
data_varpop=data.frame(PC=factor(paste("P",seq(1,10),sep=""),levels=paste("P",seq(1,10),sep="")),VAR=pca$varprop[1:10])
pp<-ggplot(data_varpop,aes(x=PC,y=VAR))+
geom_bar(stat='identity',fill="dodgerblue2",alpha=0.25)+
theme_classic()+
xlab("Principal Component")+
ylab("Variation explained (%)")
```
```{r}
subplot(ggplotly(p1)%>% layout(legend = list(orientation = "h", x = 0.2, y =-0.15)), ggplotly(p2)%>%hide_legend(), ggplotly(pp)%>%hide_legend(), titleX=T,titleY=T,margin=0.035,widths=c(0.375,0.425,0.2),which_layout=1) %>% partial_bundle()
```
### maf = 0.25
```{r}
pca=PCA_list$All_filtered$maf0.25[[1]]
data_pca=data.frame(INDIV=pca$sample.id,
PC1=pca$eigenvect[,1],
PC2=pca$eigenvect[,2],
PC3=pca$eigenvect[,3],
PC4=pca$eigenvect[,4],
LOCA=c(rep("Algarve",5),
rep("Bay of Biscay",5),
rep("Gulf of Lion",5),
rep("Costa Calida",5)))
color_med_atl=rev(brewer.pal(n=4,name="RdBu"))
p<-ggplot(data=data_pca,aes(x=PC1,y=PC2,label=INDIV))+
theme_minimal()+
theme(panel.grid=element_blank(),
panel.border=element_rect(fill="transparent"),
plot.title=element_text(hjust=0.5))+
geom_hline(yintercept=0,lty=2)+
geom_vline(xintercept=0,lty=2)+
geom_point(size=3,aes(col=LOCA))+
xlab(paste("PCA 1 (",round(pca$varprop[1]*100,2),"% )",sep=""))+
ylab(paste("PCA 2 (",round(pca$varprop[2]*100,2),"% )",sep=""))+
scale_colour_manual(name="Location",
values=c(color_med_atl[2],
color_med_atl[1],
color_med_atl[3],
color_med_atl[4]))
p1<-p
p<-ggplot(data=data_pca,aes(x=PC3,y=PC4,label=INDIV))+
theme_minimal()+
theme(panel.grid=element_blank(),
panel.border=element_rect(fill="transparent"),
plot.title=element_text(hjust=0.5))+
geom_hline(yintercept=0,lty=2)+
geom_vline(xintercept=0,lty=2)+
geom_point(size=3,aes(col=LOCA))+
xlab(paste("PCA 3 (",round(pca$varprop[3]*100,2),"% )",sep=""))+
ylab(paste("PCA 4 (",round(pca$varprop[4]*100,2),"% )",sep=""))+
scale_colour_manual(name="Location",
values=c(color_med_atl[2],
color_med_atl[1],
color_med_atl[3],
color_med_atl[4]))
p2<-p
data_varpop=data.frame(PC=factor(paste("P",seq(1,10),sep=""),levels=paste("P",seq(1,10),sep="")),VAR=pca$varprop[1:10])
pp<-ggplot(data_varpop,aes(x=PC,y=VAR))+
geom_bar(stat='identity',fill="dodgerblue2",alpha=0.25)+
theme_classic()+
xlab("Principal Component")+
ylab("Variation explained (%)")
```
```{r}
subplot(ggplotly(p1)%>% layout(legend = list(orientation = "h", x = 0.2, y =-0.15)), ggplotly(p2)%>%hide_legend(), ggplotly(pp)%>%hide_legend(), titleX=T,titleY=T,margin=0.035,widths=c(0.375,0.425,0.2),which_layout=1) %>% partial_bundle()
```
### maf = 0.30
```{r}
pca=PCA_list$All_filtered$maf0.3[[1]]
data_pca=data.frame(INDIV=pca$sample.id,
PC1=pca$eigenvect[,1],
PC2=pca$eigenvect[,2],
PC3=pca$eigenvect[,3],
PC4=pca$eigenvect[,4],
LOCA=c(rep("Algarve",5),
rep("Bay of Biscay",5),
rep("Gulf of Lion",5),
rep("Costa Calida",5)))
color_med_atl=rev(brewer.pal(n=4,name="RdBu"))
p<-ggplot(data=data_pca,aes(x=PC1,y=PC2,label=INDIV))+
theme_minimal()+
theme(panel.grid=element_blank(),
panel.border=element_rect(fill="transparent"),
plot.title=element_text(hjust=0.5))+
geom_hline(yintercept=0,lty=2)+
geom_vline(xintercept=0,lty=2)+
geom_point(size=3,aes(col=LOCA))+
xlab(paste("PCA 1 (",round(pca$varprop[1]*100,2),"% )",sep=""))+
ylab(paste("PCA 2 (",round(pca$varprop[2]*100,2),"% )",sep=""))+
scale_colour_manual(name="Location",
values=c(color_med_atl[2],
color_med_atl[1],
color_med_atl[3],
color_med_atl[4]))
p1<-p
p<-ggplot(data=data_pca,aes(x=PC3,y=PC4,label=INDIV))+
theme_minimal()+
theme(panel.grid=element_blank(),
panel.border=element_rect(fill="transparent"),
plot.title=element_text(hjust=0.5))+
geom_hline(yintercept=0,lty=2)+
geom_vline(xintercept=0,lty=2)+
geom_point(size=3,aes(col=LOCA))+
xlab(paste("PCA 3 (",round(pca$varprop[3]*100,2),"% )",sep=""))+
ylab(paste("PCA 4 (",round(pca$varprop[4]*100,2),"% )",sep=""))+
scale_colour_manual(name="Location",
values=c(color_med_atl[2],
color_med_atl[1],
color_med_atl[3],
color_med_atl[4]))
p2<-p
data_varpop=data.frame(PC=factor(paste("P",seq(1,10),sep=""),levels=paste("P",seq(1,10),sep="")),VAR=pca$varprop[1:10])
pp<-ggplot(data_varpop,aes(x=PC,y=VAR))+
geom_bar(stat='identity',fill="dodgerblue2",alpha=0.25)+
theme_classic()+
xlab("Principal Component")+
ylab("Variation explained (%)")
```
```{r}
subplot(ggplotly(p1)%>% layout(legend = list(orientation = "h", x = 0.2, y =-0.15)), ggplotly(p2)%>%hide_legend(), ggplotly(pp)%>%hide_legend(), titleX=T,titleY=T,margin=0.035,widths=c(0.375,0.425,0.2),which_layout=1) %>% partial_bundle()
```
### maf = 0.35
```{r}
pca=PCA_list$All_filtered$maf0.35[[1]]
data_pca=data.frame(INDIV=pca$sample.id,
PC1=pca$eigenvect[,1],
PC2=pca$eigenvect[,2],
PC3=pca$eigenvect[,3],
PC4=pca$eigenvect[,4],
LOCA=c(rep("Algarve",5),
rep("Bay of Biscay",5),
rep("Gulf of Lion",5),
rep("Costa Calida",5)))
color_med_atl=rev(brewer.pal(n=4,name="RdBu"))
p<-ggplot(data=data_pca,aes(x=PC1,y=PC2,label=INDIV))+
theme_minimal()+
theme(panel.grid=element_blank(),
panel.border=element_rect(fill="transparent"),
plot.title=element_text(hjust=0.5))+
geom_hline(yintercept=0,lty=2)+
geom_vline(xintercept=0,lty=2)+
geom_point(size=3,aes(col=LOCA))+
xlab(paste("PCA 1 (",round(pca$varprop[1]*100,2),"% )",sep=""))+
ylab(paste("PCA 2 (",round(pca$varprop[2]*100,2),"% )",sep=""))+
scale_colour_manual(name="Location",
values=c(color_med_atl[2],
color_med_atl[1],
color_med_atl[3],
color_med_atl[4]))
p1<-p
p<-ggplot(data=data_pca,aes(x=PC3,y=PC4,label=INDIV))+
theme_minimal()+
theme(panel.grid=element_blank(),
panel.border=element_rect(fill="transparent"),
plot.title=element_text(hjust=0.5))+
geom_hline(yintercept=0,lty=2)+
geom_vline(xintercept=0,lty=2)+
geom_point(size=3,aes(col=LOCA))+
xlab(paste("PCA 3 (",round(pca$varprop[3]*100,2),"% )",sep=""))+
ylab(paste("PCA 4 (",round(pca$varprop[4]*100,2),"% )",sep=""))+
scale_colour_manual(name="Location",
values=c(color_med_atl[2],
color_med_atl[1],
color_med_atl[3],
color_med_atl[4]))
p2<-p
data_varpop=data.frame(PC=factor(paste("P",seq(1,10),sep=""),levels=paste("P",seq(1,10),sep="")),VAR=pca$varprop[1:10])
pp<-ggplot(data_varpop,aes(x=PC,y=VAR))+
geom_bar(stat='identity',fill="dodgerblue2",alpha=0.25)+
theme_classic()+
xlab("Principal Component")+
ylab("Variation explained (%)")
```
```{r}
subplot(ggplotly(p1)%>% layout(legend = list(orientation = "h", x = 0.2, y =-0.15)), ggplotly(p2)%>%hide_legend(), ggplotly(pp)%>%hide_legend(), titleX=T,titleY=T,margin=0.035,widths=c(0.375,0.425,0.2),which_layout=1) %>% partial_bundle()
```
### maf = 0.40
```{r}
pca=PCA_list$All_filtered$maf0.4[[1]]
data_pca=data.frame(INDIV=pca$sample.id,
PC1=pca$eigenvect[,1],
PC2=pca$eigenvect[,2],
PC3=pca$eigenvect[,3],
PC4=pca$eigenvect[,4],
LOCA=c(rep("Algarve",5),
rep("Bay of Biscay",5),
rep("Gulf of Lion",5),
rep("Costa Calida",5)))
color_med_atl=rev(brewer.pal(n=4,name="RdBu"))
p<-ggplot(data=data_pca,aes(x=PC1,y=PC2,label=INDIV))+
theme_minimal()+
theme(panel.grid=element_blank(),
panel.border=element_rect(fill="transparent"),
plot.title=element_text(hjust=0.5))+
geom_hline(yintercept=0,lty=2)+
geom_vline(xintercept=0,lty=2)+
geom_point(size=3,aes(col=LOCA))+
xlab(paste("PCA 1 (",round(pca$varprop[1]*100,2),"% )",sep=""))+
ylab(paste("PCA 2 (",round(pca$varprop[2]*100,2),"% )",sep=""))+
scale_colour_manual(name="Location",
values=c(color_med_atl[2],
color_med_atl[1],
color_med_atl[3],
color_med_atl[4]))
p1<-p
p<-ggplot(data=data_pca,aes(x=PC3,y=PC4,label=INDIV))+
theme_minimal()+
theme(panel.grid=element_blank(),
panel.border=element_rect(fill="transparent"),
plot.title=element_text(hjust=0.5))+
geom_hline(yintercept=0,lty=2)+
geom_vline(xintercept=0,lty=2)+
geom_point(size=3,aes(col=LOCA))+
xlab(paste("PCA 3 (",round(pca$varprop[3]*100,2),"% )",sep=""))+
ylab(paste("PCA 4 (",round(pca$varprop[4]*100,2),"% )",sep=""))+
scale_colour_manual(name="Location",
values=c(color_med_atl[2],
color_med_atl[1],
color_med_atl[3],
color_med_atl[4]))
p2<-p
data_varpop=data.frame(PC=factor(paste("P",seq(1,10),sep=""),levels=paste("P",seq(1,10),sep="")),VAR=pca$varprop[1:10])
pp<-ggplot(data_varpop,aes(x=PC,y=VAR))+
geom_bar(stat='identity',fill="dodgerblue2",alpha=0.25)+
theme_classic()+
xlab("Principal Component")+
ylab("Variation explained (%)")
```
```{r}
subplot(ggplotly(p1)%>% layout(legend = list(orientation = "h", x = 0.2, y =-0.15)), ggplotly(p2)%>%hide_legend(), ggplotly(pp)%>%hide_legend(), titleX=T,titleY=T,margin=0.035,widths=c(0.375,0.425,0.2),which_layout=1) %>% partial_bundle()
```
### maf = 0.45
```{r}
pca=PCA_list$All_filtered$maf0.45[[1]]
data_pca=data.frame(INDIV=pca$sample.id,
PC1=pca$eigenvect[,1],
PC2=pca$eigenvect[,2],
PC3=pca$eigenvect[,3],
PC4=pca$eigenvect[,4],
LOCA=c(rep("Algarve",5),
rep("Bay of Biscay",5),
rep("Gulf of Lion",5),
rep("Costa Calida",5)))
color_med_atl=rev(brewer.pal(n=4,name="RdBu"))
p<-ggplot(data=data_pca,aes(x=PC1,y=PC2,label=INDIV))+
theme_minimal()+
theme(panel.grid=element_blank(),
panel.border=element_rect(fill="transparent"),
plot.title=element_text(hjust=0.5))+
geom_hline(yintercept=0,lty=2)+
geom_vline(xintercept=0,lty=2)+
geom_point(size=3,aes(col=LOCA))+
xlab(paste("PCA 1 (",round(pca$varprop[1]*100,2),"% )",sep=""))+
ylab(paste("PCA 2 (",round(pca$varprop[2]*100,2),"% )",sep=""))+
scale_colour_manual(name="Location",
values=c(color_med_atl[2],
color_med_atl[1],
color_med_atl[3],
color_med_atl[4]))
p1<-p
p<-ggplot(data=data_pca,aes(x=PC3,y=PC4,label=INDIV))+
theme_minimal()+
theme(panel.grid=element_blank(),
panel.border=element_rect(fill="transparent"),
plot.title=element_text(hjust=0.5))+
geom_hline(yintercept=0,lty=2)+
geom_vline(xintercept=0,lty=2)+
geom_point(size=3,aes(col=LOCA))+
xlab(paste("PCA 3 (",round(pca$varprop[3]*100,2),"% )",sep=""))+
ylab(paste("PCA 4 (",round(pca$varprop[4]*100,2),"% )",sep=""))+
scale_colour_manual(name="Location",
values=c(color_med_atl[2],
color_med_atl[1],
color_med_atl[3],
color_med_atl[4]))
p2<-p
data_varpop=data.frame(PC=factor(paste("P",seq(1,10),sep=""),levels=paste("P",seq(1,10),sep="")),VAR=pca$varprop[1:10])
pp<-ggplot(data_varpop,aes(x=PC,y=VAR))+
geom_bar(stat='identity',fill="dodgerblue2",alpha=0.25)+
theme_classic()+
xlab("Principal Component")+
ylab("Variation explained (%)")
```
```{r}
subplot(ggplotly(p1)%>% layout(legend = list(orientation = "h", x = 0.2, y =-0.15)), ggplotly(p2)%>%hide_legend(), ggplotly(pp)%>%hide_legend(), titleX=T,titleY=T,margin=0.035,widths=c(0.375,0.425,0.2),which_layout=1) %>% partial_bundle()
```
### maf = 0.50
```{r}
pca=PCA_list$All_filtered$maf0.5[[1]]
data_pca=data.frame(INDIV=pca$sample.id,
PC1=pca$eigenvect[,1],
PC2=pca$eigenvect[,2],
PC3=pca$eigenvect[,3],
PC4=pca$eigenvect[,4],
LOCA=c(rep("Algarve",5),
rep("Bay of Biscay",5),
rep("Gulf of Lion",5),
rep("Costa Calida",5)))
color_med_atl=rev(brewer.pal(n=4,name="RdBu"))
p<-ggplot(data=data_pca,aes(x=PC1,y=PC2,label=INDIV))+
theme_minimal()+
theme(panel.grid=element_blank(),
panel.border=element_rect(fill="transparent"),
plot.title=element_text(hjust=0.5))+
geom_hline(yintercept=0,lty=2)+
geom_vline(xintercept=0,lty=2)+
geom_point(size=3,aes(col=LOCA))+
xlab(paste("PCA 1 (",round(pca$varprop[1]*100,2),"% )",sep=""))+
ylab(paste("PCA 2 (",round(pca$varprop[2]*100,2),"% )",sep=""))+
scale_colour_manual(name="Location",
values=c(color_med_atl[2],
color_med_atl[1],
color_med_atl[3],
color_med_atl[4]))
p1<-p
p<-ggplot(data=data_pca,aes(x=PC3,y=PC4,label=INDIV))+
theme_minimal()+
theme(panel.grid=element_blank(),
panel.border=element_rect(fill="transparent"),
plot.title=element_text(hjust=0.5))+
geom_hline(yintercept=0,lty=2)+
geom_vline(xintercept=0,lty=2)+
geom_point(size=3,aes(col=LOCA))+
xlab(paste("PCA 3 (",round(pca$varprop[3]*100,2),"% )",sep=""))+
ylab(paste("PCA 4 (",round(pca$varprop[4]*100,2),"% )",sep=""))+
scale_colour_manual(name="Location",
values=c(color_med_atl[2],
color_med_atl[1],
color_med_atl[3],
color_med_atl[4]))
p2<-p
data_varpop=data.frame(PC=factor(paste("P",seq(1,10),sep=""),levels=paste("P",seq(1,10),sep="")),VAR=pca$varprop[1:10])
pp<-ggplot(data_varpop,aes(x=PC,y=VAR))+
geom_bar(stat='identity',fill="dodgerblue2",alpha=0.25)+
theme_classic()+
xlab("Principal Component")+
ylab("Variation explained (%)")
```
```{r}
subplot(ggplotly(p1)%>% layout(legend = list(orientation = "h", x = 0.2, y =-0.15)), ggplotly(p2)%>%hide_legend(), ggplotly(pp)%>%hide_legend(), titleX=T,titleY=T,margin=0.035,widths=c(0.375,0.425,0.2),which_layout=1) %>% partial_bundle()
```
Row {.tabset data-height=50}
-----------------------
<center>
<font size="6">**Pruned filtered SNPS**</font>
</center>
Row {.tabset data-height=600}
-----------------------
### maf = 0
```{r}
pca=PCA_list$Prune_filtered$maf0[[1]]
data_pca=data.frame(INDIV=pca$sample.id,
PC1=pca$eigenvect[,1],
PC2=pca$eigenvect[,2],
PC3=pca$eigenvect[,3],
PC4=pca$eigenvect[,4],
LOCA=c(rep("Algarve",5),
rep("Bay of Biscay",5),
rep("Gulf of Lion",5),
rep("Costa Calida",5)))
color_med_atl=rev(brewer.pal(n=4,name="RdBu"))
p<-ggplot(data=data_pca,aes(x=PC1,y=PC2,label=INDIV))+
theme_minimal()+
theme(panel.grid=element_blank(),
panel.border=element_rect(fill="transparent"),
plot.title=element_text(hjust=0.5))+
geom_hline(yintercept=0,lty=2)+
geom_vline(xintercept=0,lty=2)+
geom_point(size=3,aes(col=LOCA))+
xlab(paste("PCA 1 (",round(pca$varprop[1]*100,2),"% )",sep=""))+
ylab(paste("PCA 2 (",round(pca$varprop[2]*100,2),"% )",sep=""))+
scale_colour_manual(name="Location",
values=c(color_med_atl[2],
color_med_atl[1],
color_med_atl[3],
color_med_atl[4]))
p1<-p
p<-ggplot(data=data_pca,aes(x=PC3,y=PC4,label=INDIV))+
theme_minimal()+
theme(panel.grid=element_blank(),
panel.border=element_rect(fill="transparent"),
plot.title=element_text(hjust=0.5))+
geom_hline(yintercept=0,lty=2)+
geom_vline(xintercept=0,lty=2)+
geom_point(size=3,aes(col=LOCA))+
xlab(paste("PCA 3 (",round(pca$varprop[3]*100,2),"% )",sep=""))+
ylab(paste("PCA 4 (",round(pca$varprop[4]*100,2),"% )",sep=""))+
scale_colour_manual(name="Location",
values=c(color_med_atl[2],
color_med_atl[1],
color_med_atl[3],
color_med_atl[4]))
p2<-p
data_varpop=data.frame(PC=factor(paste("P",seq(1,10),sep=""),levels=paste("P",seq(1,10),sep="")),VAR=pca$varprop[1:10])
pp<-ggplot(data_varpop,aes(x=PC,y=VAR))+
geom_bar(stat='identity',fill="dodgerblue2",alpha=0.25)+
theme_classic()+
xlab("Principal Component")+
ylab("Variation explained (%)")
```
```{r}
subplot(ggplotly(p1)%>% layout(legend = list(orientation = "h", x = 0.2, y =-0.15)), ggplotly(p2)%>%hide_legend(), ggplotly(pp)%>%hide_legend(), titleX=T,titleY=T,margin=0.035,widths=c(0.375,0.425,0.2),which_layout=1) %>% partial_bundle()
```
### maf = 0.05
```{r}
pca=PCA_list$Prune_filtered$maf0.05[[1]]
data_pca=data.frame(INDIV=pca$sample.id,
PC1=pca$eigenvect[,1],
PC2=pca$eigenvect[,2],
PC3=pca$eigenvect[,3],
PC4=pca$eigenvect[,4],
LOCA=c(rep("Algarve",5),
rep("Bay of Biscay",5),
rep("Gulf of Lion",5),
rep("Costa Calida",5)))
color_med_atl=rev(brewer.pal(n=4,name="RdBu"))
p<-ggplot(data=data_pca,aes(x=PC1,y=PC2,label=INDIV))+
theme_minimal()+
theme(panel.grid=element_blank(),
panel.border=element_rect(fill="transparent"),
plot.title=element_text(hjust=0.5))+
geom_hline(yintercept=0,lty=2)+
geom_vline(xintercept=0,lty=2)+
geom_point(size=3,aes(col=LOCA))+
xlab(paste("PCA 1 (",round(pca$varprop[1]*100,2),"% )",sep=""))+
ylab(paste("PCA 2 (",round(pca$varprop[2]*100,2),"% )",sep=""))+
scale_colour_manual(name="Location",
values=c(color_med_atl[2],
color_med_atl[1],
color_med_atl[3],
color_med_atl[4]))
p1<-p
p<-ggplot(data=data_pca,aes(x=PC3,y=PC4,label=INDIV))+
theme_minimal()+
theme(panel.grid=element_blank(),
panel.border=element_rect(fill="transparent"),
plot.title=element_text(hjust=0.5))+
geom_hline(yintercept=0,lty=2)+
geom_vline(xintercept=0,lty=2)+
geom_point(size=3,aes(col=LOCA))+
xlab(paste("PCA 3 (",round(pca$varprop[3]*100,2),"% )",sep=""))+
ylab(paste("PCA 4 (",round(pca$varprop[4]*100,2),"% )",sep=""))+
scale_colour_manual(name="Location",
values=c(color_med_atl[2],
color_med_atl[1],
color_med_atl[3],
color_med_atl[4]))
p2<-p
data_varpop=data.frame(PC=factor(paste("P",seq(1,10),sep=""),levels=paste("P",seq(1,10),sep="")),VAR=pca$varprop[1:10])
pp<-ggplot(data_varpop,aes(x=PC,y=VAR))+
geom_bar(stat='identity',fill="dodgerblue2",alpha=0.25)+
theme_classic()+
xlab("Principal Component")+
ylab("Variation explained (%)")
```
```{r}
subplot(ggplotly(p1)%>% layout(legend = list(orientation = "h", x = 0.2, y =-0.15)), ggplotly(p2)%>%hide_legend(), ggplotly(pp)%>%hide_legend(), titleX=T,titleY=T,margin=0.035,widths=c(0.375,0.425,0.2),which_layout=1) %>% partial_bundle()
```
### maf = 0.1
```{r}
pca=PCA_list$Prune_filtered$maf0.1[[1]]
data_pca=data.frame(INDIV=pca$sample.id,
PC1=pca$eigenvect[,1],
PC2=pca$eigenvect[,2],
PC3=pca$eigenvect[,3],
PC4=pca$eigenvect[,4],
LOCA=c(rep("Algarve",5),
rep("Bay of Biscay",5),
rep("Gulf of Lion",5),
rep("Costa Calida",5)))
color_med_atl=rev(brewer.pal(n=4,name="RdBu"))
p<-ggplot(data=data_pca,aes(x=PC1,y=PC2,label=INDIV))+
theme_minimal()+
theme(panel.grid=element_blank(),
panel.border=element_rect(fill="transparent"),
plot.title=element_text(hjust=0.5))+
geom_hline(yintercept=0,lty=2)+
geom_vline(xintercept=0,lty=2)+
geom_point(size=3,aes(col=LOCA))+
xlab(paste("PCA 1 (",round(pca$varprop[1]*100,2),"% )",sep=""))+
ylab(paste("PCA 2 (",round(pca$varprop[2]*100,2),"% )",sep=""))+
scale_colour_manual(name="Location",
values=c(color_med_atl[2],
color_med_atl[1],
color_med_atl[3],
color_med_atl[4]))
p1<-p
p<-ggplot(data=data_pca,aes(x=PC3,y=PC4,label=INDIV))+
theme_minimal()+
theme(panel.grid=element_blank(),
panel.border=element_rect(fill="transparent"),
plot.title=element_text(hjust=0.5))+
geom_hline(yintercept=0,lty=2)+
geom_vline(xintercept=0,lty=2)+
geom_point(size=3,aes(col=LOCA))+
xlab(paste("PCA 3 (",round(pca$varprop[3]*100,2),"% )",sep=""))+
ylab(paste("PCA 4 (",round(pca$varprop[4]*100,2),"% )",sep=""))+
scale_colour_manual(name="Location",
values=c(color_med_atl[2],
color_med_atl[1],
color_med_atl[3],
color_med_atl[4]))
p2<-p
data_varpop=data.frame(PC=factor(paste("P",seq(1,10),sep=""),levels=paste("P",seq(1,10),sep="")),VAR=pca$varprop[1:10])
pp<-ggplot(data_varpop,aes(x=PC,y=VAR))+
geom_bar(stat='identity',fill="dodgerblue2",alpha=0.25)+
theme_classic()+
xlab("Principal Component")+
ylab("Variation explained (%)")
```
```{r}
subplot(ggplotly(p1)%>% layout(legend = list(orientation = "h", x = 0.2, y =-0.15)), ggplotly(p2)%>%hide_legend(), ggplotly(pp)%>%hide_legend(), titleX=T,titleY=T,margin=0.035,widths=c(0.375,0.425,0.2),which_layout=1) %>% partial_bundle()
```
### maf = 0.15
```{r}
pca=PCA_list$Prune_filtered$maf0.15[[1]]
data_pca=data.frame(INDIV=pca$sample.id,
PC1=pca$eigenvect[,1],
PC2=pca$eigenvect[,2],
PC3=pca$eigenvect[,3],
PC4=pca$eigenvect[,4],
LOCA=c(rep("Algarve",5),
rep("Bay of Biscay",5),
rep("Gulf of Lion",5),
rep("Costa Calida",5)))
color_med_atl=rev(brewer.pal(n=4,name="RdBu"))
p<-ggplot(data=data_pca,aes(x=PC1,y=PC2,label=INDIV))+
theme_minimal()+
theme(panel.grid=element_blank(),
panel.border=element_rect(fill="transparent"),
plot.title=element_text(hjust=0.5))+
geom_hline(yintercept=0,lty=2)+
geom_vline(xintercept=0,lty=2)+
geom_point(size=3,aes(col=LOCA))+
xlab(paste("PCA 1 (",round(pca$varprop[1]*100,2),"% )",sep=""))+
ylab(paste("PCA 2 (",round(pca$varprop[2]*100,2),"% )",sep=""))+
scale_colour_manual(name="Location",
values=c(color_med_atl[2],
color_med_atl[1],
color_med_atl[3],
color_med_atl[4]))
p1<-p
p<-ggplot(data=data_pca,aes(x=PC3,y=PC4,label=INDIV))+
theme_minimal()+
theme(panel.grid=element_blank(),
panel.border=element_rect(fill="transparent"),
plot.title=element_text(hjust=0.5))+
geom_hline(yintercept=0,lty=2)+
geom_vline(xintercept=0,lty=2)+
geom_point(size=3,aes(col=LOCA))+
xlab(paste("PCA 3 (",round(pca$varprop[3]*100,2),"% )",sep=""))+
ylab(paste("PCA 4 (",round(pca$varprop[4]*100,2),"% )",sep=""))+
scale_colour_manual(name="Location",
values=c(color_med_atl[2],
color_med_atl[1],
color_med_atl[3],
color_med_atl[4]))
p2<-p
data_varpop=data.frame(PC=factor(paste("P",seq(1,10),sep=""),levels=paste("P",seq(1,10),sep="")),VAR=pca$varprop[1:10])
pp<-ggplot(data_varpop,aes(x=PC,y=VAR))+
geom_bar(stat='identity',fill="dodgerblue2",alpha=0.25)+
theme_classic()+
xlab("Principal Component")+
ylab("Variation explained (%)")
```
```{r}
subplot(ggplotly(p1)%>% layout(legend = list(orientation = "h", x = 0.2, y =-0.15)), ggplotly(p2)%>%hide_legend(), ggplotly(pp)%>%hide_legend(), titleX=T,titleY=T,margin=0.035,widths=c(0.375,0.425,0.2),which_layout=1) %>% partial_bundle()
```
### maf = 0.20
```{r}
pca=PCA_list$Prune_filtered$maf0.2[[1]]
data_pca=data.frame(INDIV=pca$sample.id,
PC1=pca$eigenvect[,1],
PC2=pca$eigenvect[,2],
PC3=pca$eigenvect[,3],
PC4=pca$eigenvect[,4],
LOCA=c(rep("Algarve",5),
rep("Bay of Biscay",5),
rep("Gulf of Lion",5),
rep("Costa Calida",5)))
color_med_atl=rev(brewer.pal(n=4,name="RdBu"))
p<-ggplot(data=data_pca,aes(x=PC1,y=PC2,label=INDIV))+
theme_minimal()+
theme(panel.grid=element_blank(),
panel.border=element_rect(fill="transparent"),
plot.title=element_text(hjust=0.5))+
geom_hline(yintercept=0,lty=2)+
geom_vline(xintercept=0,lty=2)+
geom_point(size=3,aes(col=LOCA))+
xlab(paste("PCA 1 (",round(pca$varprop[1]*100,2),"% )",sep=""))+
ylab(paste("PCA 2 (",round(pca$varprop[2]*100,2),"% )",sep=""))+
scale_colour_manual(name="Location",
values=c(color_med_atl[2],
color_med_atl[1],
color_med_atl[3],
color_med_atl[4]))
p1<-p
p<-ggplot(data=data_pca,aes(x=PC3,y=PC4,label=INDIV))+
theme_minimal()+
theme(panel.grid=element_blank(),
panel.border=element_rect(fill="transparent"),
plot.title=element_text(hjust=0.5))+
geom_hline(yintercept=0,lty=2)+
geom_vline(xintercept=0,lty=2)+
geom_point(size=3,aes(col=LOCA))+
xlab(paste("PCA 3 (",round(pca$varprop[3]*100,2),"% )",sep=""))+
ylab(paste("PCA 4 (",round(pca$varprop[4]*100,2),"% )",sep=""))+
scale_colour_manual(name="Location",
values=c(color_med_atl[2],
color_med_atl[1],
color_med_atl[3],
color_med_atl[4]))
p2<-p
data_varpop=data.frame(PC=factor(paste("P",seq(1,10),sep=""),levels=paste("P",seq(1,10),sep="")),VAR=pca$varprop[1:10])
pp<-ggplot(data_varpop,aes(x=PC,y=VAR))+
geom_bar(stat='identity',fill="dodgerblue2",alpha=0.25)+
theme_classic()+
xlab("Principal Component")+
ylab("Variation explained (%)")
```
```{r}
subplot(ggplotly(p1)%>% layout(legend = list(orientation = "h", x = 0.2, y =-0.15)), ggplotly(p2)%>%hide_legend(), ggplotly(pp)%>%hide_legend(), titleX=T,titleY=T,margin=0.035,widths=c(0.375,0.425,0.2),which_layout=1) %>% partial_bundle()
```
### maf = 0.25
```{r}
pca=PCA_list$Prune_filtered$maf0.25[[1]]
data_pca=data.frame(INDIV=pca$sample.id,
PC1=pca$eigenvect[,1],
PC2=pca$eigenvect[,2],
PC3=pca$eigenvect[,3],
PC4=pca$eigenvect[,4],
LOCA=c(rep("Algarve",5),
rep("Bay of Biscay",5),
rep("Gulf of Lion",5),
rep("Costa Calida",5)))
color_med_atl=rev(brewer.pal(n=4,name="RdBu"))
p<-ggplot(data=data_pca,aes(x=PC1,y=PC2,label=INDIV))+
theme_minimal()+
theme(panel.grid=element_blank(),
panel.border=element_rect(fill="transparent"),
plot.title=element_text(hjust=0.5))+
geom_hline(yintercept=0,lty=2)+
geom_vline(xintercept=0,lty=2)+
geom_point(size=3,aes(col=LOCA))+
xlab(paste("PCA 1 (",round(pca$varprop[1]*100,2),"% )",sep=""))+
ylab(paste("PCA 2 (",round(pca$varprop[2]*100,2),"% )",sep=""))+
scale_colour_manual(name="Location",
values=c(color_med_atl[2],
color_med_atl[1],
color_med_atl[3],
color_med_atl[4]))
p1<-p
p<-ggplot(data=data_pca,aes(x=PC3,y=PC4,label=INDIV))+
theme_minimal()+
theme(panel.grid=element_blank(),
panel.border=element_rect(fill="transparent"),
plot.title=element_text(hjust=0.5))+
geom_hline(yintercept=0,lty=2)+
geom_vline(xintercept=0,lty=2)+
geom_point(size=3,aes(col=LOCA))+
xlab(paste("PCA 3 (",round(pca$varprop[3]*100,2),"% )",sep=""))+
ylab(paste("PCA 4 (",round(pca$varprop[4]*100,2),"% )",sep=""))+
scale_colour_manual(name="Location",
values=c(color_med_atl[2],
color_med_atl[1],
color_med_atl[3],
color_med_atl[4]))
p2<-p
data_varpop=data.frame(PC=factor(paste("P",seq(1,10),sep=""),levels=paste("P",seq(1,10),sep="")),VAR=pca$varprop[1:10])
pp<-ggplot(data_varpop,aes(x=PC,y=VAR))+
geom_bar(stat='identity',fill="dodgerblue2",alpha=0.25)+
theme_classic()+
xlab("Principal Component")+
ylab("Variation explained (%)")
```
```{r}
subplot(ggplotly(p1)%>% layout(legend = list(orientation = "h", x = 0.2, y =-0.15)), ggplotly(p2)%>%hide_legend(), ggplotly(pp)%>%hide_legend(), titleX=T,titleY=T,margin=0.035,widths=c(0.375,0.425,0.2),which_layout=1) %>% partial_bundle()
```
### maf = 0.30
```{r}
pca=PCA_list$Prune_filtered$maf0.3[[1]]
data_pca=data.frame(INDIV=pca$sample.id,
PC1=pca$eigenvect[,1],
PC2=pca$eigenvect[,2],
PC3=pca$eigenvect[,3],
PC4=pca$eigenvect[,4],
LOCA=c(rep("Algarve",5),
rep("Bay of Biscay",5),
rep("Gulf of Lion",5),
rep("Costa Calida",5)))
color_med_atl=rev(brewer.pal(n=4,name="RdBu"))
p<-ggplot(data=data_pca,aes(x=PC1,y=PC2,label=INDIV))+
theme_minimal()+
theme(panel.grid=element_blank(),
panel.border=element_rect(fill="transparent"),
plot.title=element_text(hjust=0.5))+
geom_hline(yintercept=0,lty=2)+
geom_vline(xintercept=0,lty=2)+
geom_point(size=3,aes(col=LOCA))+
xlab(paste("PCA 1 (",round(pca$varprop[1]*100,2),"% )",sep=""))+
ylab(paste("PCA 2 (",round(pca$varprop[2]*100,2),"% )",sep=""))+
scale_colour_manual(name="Location",
values=c(color_med_atl[2],
color_med_atl[1],
color_med_atl[3],
color_med_atl[4]))
p1<-p
p<-ggplot(data=data_pca,aes(x=PC3,y=PC4,label=INDIV))+
theme_minimal()+
theme(panel.grid=element_blank(),
panel.border=element_rect(fill="transparent"),
plot.title=element_text(hjust=0.5))+
geom_hline(yintercept=0,lty=2)+
geom_vline(xintercept=0,lty=2)+
geom_point(size=3,aes(col=LOCA))+
xlab(paste("PCA 3 (",round(pca$varprop[3]*100,2),"% )",sep=""))+
ylab(paste("PCA 4 (",round(pca$varprop[4]*100,2),"% )",sep=""))+
scale_colour_manual(name="Location",
values=c(color_med_atl[2],
color_med_atl[1],
color_med_atl[3],
color_med_atl[4]))
p2<-p
data_varpop=data.frame(PC=factor(paste("P",seq(1,10),sep=""),levels=paste("P",seq(1,10),sep="")),VAR=pca$varprop[1:10])
pp<-ggplot(data_varpop,aes(x=PC,y=VAR))+
geom_bar(stat='identity',fill="dodgerblue2",alpha=0.25)+
theme_classic()+
xlab("Principal Component")+
ylab("Variation explained (%)")
```
```{r}
subplot(ggplotly(p1)%>% layout(legend = list(orientation = "h", x = 0.2, y =-0.15)), ggplotly(p2)%>%hide_legend(), ggplotly(pp)%>%hide_legend(), titleX=T,titleY=T,margin=0.035,widths=c(0.375,0.425,0.2),which_layout=1) %>% partial_bundle()
```
### maf = 0.35
```{r}
pca=PCA_list$Prune_filtered$maf0.35[[1]]
data_pca=data.frame(INDIV=pca$sample.id,
PC1=pca$eigenvect[,1],
PC2=pca$eigenvect[,2],
PC3=pca$eigenvect[,3],
PC4=pca$eigenvect[,4],
LOCA=c(rep("Algarve",5),
rep("Bay of Biscay",5),
rep("Gulf of Lion",5),
rep("Costa Calida",5)))
color_med_atl=rev(brewer.pal(n=4,name="RdBu"))
p<-ggplot(data=data_pca,aes(x=PC1,y=PC2,label=INDIV))+
theme_minimal()+
theme(panel.grid=element_blank(),
panel.border=element_rect(fill="transparent"),
plot.title=element_text(hjust=0.5))+
geom_hline(yintercept=0,lty=2)+
geom_vline(xintercept=0,lty=2)+
geom_point(size=3,aes(col=LOCA))+
xlab(paste("PCA 1 (",round(pca$varprop[1]*100,2),"% )",sep=""))+
ylab(paste("PCA 2 (",round(pca$varprop[2]*100,2),"% )",sep=""))+
scale_colour_manual(name="Location",
values=c(color_med_atl[2],
color_med_atl[1],
color_med_atl[3],
color_med_atl[4]))
p1<-p
p<-ggplot(data=data_pca,aes(x=PC3,y=PC4,label=INDIV))+
theme_minimal()+
theme(panel.grid=element_blank(),
panel.border=element_rect(fill="transparent"),
plot.title=element_text(hjust=0.5))+
geom_hline(yintercept=0,lty=2)+
geom_vline(xintercept=0,lty=2)+
geom_point(size=3,aes(col=LOCA))+
xlab(paste("PCA 3 (",round(pca$varprop[3]*100,2),"% )",sep=""))+
ylab(paste("PCA 4 (",round(pca$varprop[4]*100,2),"% )",sep=""))+
scale_colour_manual(name="Location",
values=c(color_med_atl[2],
color_med_atl[1],
color_med_atl[3],
color_med_atl[4]))
p2<-p
data_varpop=data.frame(PC=factor(paste("P",seq(1,10),sep=""),levels=paste("P",seq(1,10),sep="")),VAR=pca$varprop[1:10])
pp<-ggplot(data_varpop,aes(x=PC,y=VAR))+
geom_bar(stat='identity',fill="dodgerblue2",alpha=0.25)+
theme_classic()+
xlab("Principal Component")+
ylab("Variation explained (%)")
```
```{r}
subplot(ggplotly(p1)%>% layout(legend = list(orientation = "h", x = 0.2, y =-0.15)), ggplotly(p2)%>%hide_legend(), ggplotly(pp)%>%hide_legend(), titleX=T,titleY=T,margin=0.035,widths=c(0.375,0.425,0.2),which_layout=1) %>% partial_bundle()
```
### maf = 0.40
```{r}
pca=PCA_list$Prune_filtered$maf0.4[[1]]
data_pca=data.frame(INDIV=pca$sample.id,
PC1=pca$eigenvect[,1],
PC2=pca$eigenvect[,2],
PC3=pca$eigenvect[,3],
PC4=pca$eigenvect[,4],
LOCA=c(rep("Algarve",5),
rep("Bay of Biscay",5),
rep("Gulf of Lion",5),
rep("Costa Calida",5)))
color_med_atl=rev(brewer.pal(n=4,name="RdBu"))
p<-ggplot(data=data_pca,aes(x=PC1,y=PC2,label=INDIV))+
theme_minimal()+
theme(panel.grid=element_blank(),
panel.border=element_rect(fill="transparent"),
plot.title=element_text(hjust=0.5))+
geom_hline(yintercept=0,lty=2)+
geom_vline(xintercept=0,lty=2)+
geom_point(size=3,aes(col=LOCA))+
xlab(paste("PCA 1 (",round(pca$varprop[1]*100,2),"% )",sep=""))+
ylab(paste("PCA 2 (",round(pca$varprop[2]*100,2),"% )",sep=""))+
scale_colour_manual(name="Location",
values=c(color_med_atl[2],
color_med_atl[1],
color_med_atl[3],
color_med_atl[4]))
p1<-p
p<-ggplot(data=data_pca,aes(x=PC3,y=PC4,label=INDIV))+
theme_minimal()+
theme(panel.grid=element_blank(),
panel.border=element_rect(fill="transparent"),
plot.title=element_text(hjust=0.5))+
geom_hline(yintercept=0,lty=2)+
geom_vline(xintercept=0,lty=2)+
geom_point(size=3,aes(col=LOCA))+
xlab(paste("PCA 3 (",round(pca$varprop[3]*100,2),"% )",sep=""))+
ylab(paste("PCA 4 (",round(pca$varprop[4]*100,2),"% )",sep=""))+
scale_colour_manual(name="Location",
values=c(color_med_atl[2],
color_med_atl[1],
color_med_atl[3],
color_med_atl[4]))
p2<-p
data_varpop=data.frame(PC=factor(paste("P",seq(1,10),sep=""),levels=paste("P",seq(1,10),sep="")),VAR=pca$varprop[1:10])
pp<-ggplot(data_varpop,aes(x=PC,y=VAR))+
geom_bar(stat='identity',fill="dodgerblue2",alpha=0.25)+
theme_classic()+
xlab("Principal Component")+
ylab("Variation explained (%)")
```
```{r}
subplot(ggplotly(p1)%>% layout(legend = list(orientation = "h", x = 0.2, y =-0.15)), ggplotly(p2)%>%hide_legend(), ggplotly(pp)%>%hide_legend(), titleX=T,titleY=T,margin=0.035,widths=c(0.375,0.425,0.2),which_layout=1) %>% partial_bundle()
```
### maf = 0.45
```{r}
pca=PCA_list$Prune_filtered$maf0.45[[1]]
data_pca=data.frame(INDIV=pca$sample.id,
PC1=pca$eigenvect[,1],
PC2=pca$eigenvect[,2],
PC3=pca$eigenvect[,3],
PC4=pca$eigenvect[,4],
LOCA=c(rep("Algarve",5),
rep("Bay of Biscay",5),
rep("Gulf of Lion",5),
rep("Costa Calida",5)))
color_med_atl=rev(brewer.pal(n=4,name="RdBu"))
p<-ggplot(data=data_pca,aes(x=PC1,y=PC2,label=INDIV))+
theme_minimal()+
theme(panel.grid=element_blank(),
panel.border=element_rect(fill="transparent"),
plot.title=element_text(hjust=0.5))+
geom_hline(yintercept=0,lty=2)+
geom_vline(xintercept=0,lty=2)+
geom_point(size=3,aes(col=LOCA))+
xlab(paste("PCA 1 (",round(pca$varprop[1]*100,2),"% )",sep=""))+
ylab(paste("PCA 2 (",round(pca$varprop[2]*100,2),"% )",sep=""))+
scale_colour_manual(name="Location",
values=c(color_med_atl[2],
color_med_atl[1],
color_med_atl[3],
color_med_atl[4]))
p1<-p
p<-ggplot(data=data_pca,aes(x=PC3,y=PC4,label=INDIV))+
theme_minimal()+
theme(panel.grid=element_blank(),
panel.border=element_rect(fill="transparent"),
plot.title=element_text(hjust=0.5))+
geom_hline(yintercept=0,lty=2)+
geom_vline(xintercept=0,lty=2)+
geom_point(size=3,aes(col=LOCA))+
xlab(paste("PCA 3 (",round(pca$varprop[3]*100,2),"% )",sep=""))+
ylab(paste("PCA 4 (",round(pca$varprop[4]*100,2),"% )",sep=""))+
scale_colour_manual(name="Location",
values=c(color_med_atl[2],
color_med_atl[1],
color_med_atl[3],
color_med_atl[4]))
p2<-p
data_varpop=data.frame(PC=factor(paste("P",seq(1,10),sep=""),levels=paste("P",seq(1,10),sep="")),VAR=pca$varprop[1:10])
pp<-ggplot(data_varpop,aes(x=PC,y=VAR))+
geom_bar(stat='identity',fill="dodgerblue2",alpha=0.25)+
theme_classic()+
xlab("Principal Component")+
ylab("Variation explained (%)")
```
```{r}
subplot(ggplotly(p1)%>% layout(legend = list(orientation = "h", x = 0.2, y =-0.15)), ggplotly(p2)%>%hide_legend(), ggplotly(pp)%>%hide_legend(), titleX=T,titleY=T,margin=0.035,widths=c(0.375,0.425,0.2),which_layout=1) %>% partial_bundle()
```
### maf = 0.50
```{r}
pca=PCA_list$Prune_filtered$maf0.5[[1]]
data_pca=data.frame(INDIV=pca$sample.id,
PC1=pca$eigenvect[,1],
PC2=pca$eigenvect[,2],
PC3=pca$eigenvect[,3],
PC4=pca$eigenvect[,4],
LOCA=c(rep("Algarve",5),
rep("Bay of Biscay",5),
rep("Gulf of Lion",5),
rep("Costa Calida",5)))
color_med_atl=rev(brewer.pal(n=4,name="RdBu"))
p<-ggplot(data=data_pca,aes(x=PC1,y=PC2,label=INDIV))+
theme_minimal()+
theme(panel.grid=element_blank(),
panel.border=element_rect(fill="transparent"),
plot.title=element_text(hjust=0.5))+
geom_hline(yintercept=0,lty=2)+
geom_vline(xintercept=0,lty=2)+
geom_point(size=3,aes(col=LOCA))+
xlab(paste("PCA 1 (",round(pca$varprop[1]*100,2),"% )",sep=""))+
ylab(paste("PCA 2 (",round(pca$varprop[2]*100,2),"% )",sep=""))+
scale_colour_manual(name="Location",
values=c(color_med_atl[2],
color_med_atl[1],
color_med_atl[3],
color_med_atl[4]))
p1<-p
p<-ggplot(data=data_pca,aes(x=PC3,y=PC4,label=INDIV))+
theme_minimal()+
theme(panel.grid=element_blank(),
panel.border=element_rect(fill="transparent"),
plot.title=element_text(hjust=0.5))+
geom_hline(yintercept=0,lty=2)+
geom_vline(xintercept=0,lty=2)+
geom_point(size=3,aes(col=LOCA))+
xlab(paste("PCA 3 (",round(pca$varprop[3]*100,2),"% )",sep=""))+
ylab(paste("PCA 4 (",round(pca$varprop[4]*100,2),"% )",sep=""))+
scale_colour_manual(name="Location",
values=c(color_med_atl[2],
color_med_atl[1],
color_med_atl[3],
color_med_atl[4]))
p2<-p
data_varpop=data.frame(PC=factor(paste("P",seq(1,10),sep=""),levels=paste("P",seq(1,10),sep="")),VAR=pca$varprop[1:10])
pp<-ggplot(data_varpop,aes(x=PC,y=VAR))+
geom_bar(stat='identity',fill="dodgerblue2",alpha=0.25)+
theme_classic()+
xlab("Principal Component")+
ylab("Variation explained (%)")
```
```{r}
subplot(ggplotly(p1)%>% layout(legend = list(orientation = "h", x = 0.2, y =-0.15)), ggplotly(p2)%>%hide_legend(), ggplotly(pp)%>%hide_legend(), titleX=T,titleY=T,margin=0.035,widths=c(0.375,0.425,0.2),which_layout=1) %>% partial_bundle()
```
Row {.tabset data-height=50}
-----------------------
<center>
<font size="6">**All unfiltered SNPS**</font>
</center>
Row {.tabset data-height=600}
-----------------------
### maf = 0
```{r}
pca=PCA_list$All_unfiltered$maf0[[1]]
data_pca=data.frame(INDIV=pca$sample.id,
PC1=pca$eigenvect[,1],
PC2=pca$eigenvect[,2],
PC3=pca$eigenvect[,3],
PC4=pca$eigenvect[,4],
LOCA=c(rep("Algarve",5),
rep("Bay of Biscay",5),
rep("Gulf of Lion",5),
rep("Costa Calida",5)))
color_med_atl=rev(brewer.pal(n=4,name="RdBu"))
p<-ggplot(data=data_pca,aes(x=PC1,y=PC2,label=INDIV))+
theme_minimal()+
theme(panel.grid=element_blank(),
panel.border=element_rect(fill="transparent"),
plot.title=element_text(hjust=0.5))+
geom_hline(yintercept=0,lty=2)+
geom_vline(xintercept=0,lty=2)+
geom_point(size=3,aes(col=LOCA))+
xlab(paste("PCA 1 (",round(pca$varprop[1]*100,2),"% )",sep=""))+
ylab(paste("PCA 2 (",round(pca$varprop[2]*100,2),"% )",sep=""))+
scale_colour_manual(name="Location",
values=c(color_med_atl[2],
color_med_atl[1],
color_med_atl[3],
color_med_atl[4]))
p1<-p
p<-ggplot(data=data_pca,aes(x=PC3,y=PC4,label=INDIV))+
theme_minimal()+
theme(panel.grid=element_blank(),
panel.border=element_rect(fill="transparent"),
plot.title=element_text(hjust=0.5))+
geom_hline(yintercept=0,lty=2)+
geom_vline(xintercept=0,lty=2)+
geom_point(size=3,aes(col=LOCA))+
xlab(paste("PCA 3 (",round(pca$varprop[3]*100,2),"% )",sep=""))+
ylab(paste("PCA 4 (",round(pca$varprop[4]*100,2),"% )",sep=""))+
scale_colour_manual(name="Location",
values=c(color_med_atl[2],
color_med_atl[1],
color_med_atl[3],
color_med_atl[4]))
p2<-p
data_varpop=data.frame(PC=factor(paste("P",seq(1,10),sep=""),levels=paste("P",seq(1,10),sep="")),VAR=pca$varprop[1:10])
pp<-ggplot(data_varpop,aes(x=PC,y=VAR))+
geom_bar(stat='identity',fill="dodgerblue2",alpha=0.25)+
theme_classic()+
xlab("Principal Component")+
ylab("Variation explained (%)")
```
```{r}
subplot(ggplotly(p1)%>% layout(legend = list(orientation = "h", x = 0.2, y =-0.15)), ggplotly(p2)%>%hide_legend(), ggplotly(pp)%>%hide_legend(), titleX=T,titleY=T,margin=0.035,widths=c(0.375,0.425,0.2),which_layout=1) %>% partial_bundle()
```
### maf = 0.05
```{r}
pca=PCA_list$All_unfiltered$maf0.05[[1]]
data_pca=data.frame(INDIV=pca$sample.id,
PC1=pca$eigenvect[,1],
PC2=pca$eigenvect[,2],
PC3=pca$eigenvect[,3],
PC4=pca$eigenvect[,4],
LOCA=c(rep("Algarve",5),
rep("Bay of Biscay",5),
rep("Gulf of Lion",5),
rep("Costa Calida",5)))
color_med_atl=rev(brewer.pal(n=4,name="RdBu"))
p<-ggplot(data=data_pca,aes(x=PC1,y=PC2,label=INDIV))+
theme_minimal()+
theme(panel.grid=element_blank(),
panel.border=element_rect(fill="transparent"),
plot.title=element_text(hjust=0.5))+
geom_hline(yintercept=0,lty=2)+
geom_vline(xintercept=0,lty=2)+
geom_point(size=3,aes(col=LOCA))+
xlab(paste("PCA 1 (",round(pca$varprop[1]*100,2),"% )",sep=""))+
ylab(paste("PCA 2 (",round(pca$varprop[2]*100,2),"% )",sep=""))+
scale_colour_manual(name="Location",
values=c(color_med_atl[2],
color_med_atl[1],
color_med_atl[3],
color_med_atl[4]))
p1<-p
p<-ggplot(data=data_pca,aes(x=PC3,y=PC4,label=INDIV))+
theme_minimal()+
theme(panel.grid=element_blank(),
panel.border=element_rect(fill="transparent"),
plot.title=element_text(hjust=0.5))+
geom_hline(yintercept=0,lty=2)+
geom_vline(xintercept=0,lty=2)+
geom_point(size=3,aes(col=LOCA))+
xlab(paste("PCA 3 (",round(pca$varprop[3]*100,2),"% )",sep=""))+
ylab(paste("PCA 4 (",round(pca$varprop[4]*100,2),"% )",sep=""))+
scale_colour_manual(name="Location",
values=c(color_med_atl[2],
color_med_atl[1],
color_med_atl[3],
color_med_atl[4]))
p2<-p
data_varpop=data.frame(PC=factor(paste("P",seq(1,10),sep=""),levels=paste("P",seq(1,10),sep="")),VAR=pca$varprop[1:10])
pp<-ggplot(data_varpop,aes(x=PC,y=VAR))+
geom_bar(stat='identity',fill="dodgerblue2",alpha=0.25)+
theme_classic()+
xlab("Principal Component")+
ylab("Variation explained (%)")
```
```{r}
subplot(ggplotly(p1)%>% layout(legend = list(orientation = "h", x = 0.2, y =-0.15)), ggplotly(p2)%>%hide_legend(), ggplotly(pp)%>%hide_legend(), titleX=T,titleY=T,margin=0.035,widths=c(0.375,0.425,0.2),which_layout=1) %>% partial_bundle()
```
### maf = 0.1
```{r}
pca=PCA_list$All_unfiltered$maf0.1[[1]]
data_pca=data.frame(INDIV=pca$sample.id,
PC1=pca$eigenvect[,1],
PC2=pca$eigenvect[,2],
PC3=pca$eigenvect[,3],
PC4=pca$eigenvect[,4],
LOCA=c(rep("Algarve",5),
rep("Bay of Biscay",5),
rep("Gulf of Lion",5),
rep("Costa Calida",5)))
color_med_atl=rev(brewer.pal(n=4,name="RdBu"))
p<-ggplot(data=data_pca,aes(x=PC1,y=PC2,label=INDIV))+
theme_minimal()+
theme(panel.grid=element_blank(),
panel.border=element_rect(fill="transparent"),
plot.title=element_text(hjust=0.5))+
geom_hline(yintercept=0,lty=2)+
geom_vline(xintercept=0,lty=2)+
geom_point(size=3,aes(col=LOCA))+
xlab(paste("PCA 1 (",round(pca$varprop[1]*100,2),"% )",sep=""))+
ylab(paste("PCA 2 (",round(pca$varprop[2]*100,2),"% )",sep=""))+
scale_colour_manual(name="Location",
values=c(color_med_atl[2],
color_med_atl[1],
color_med_atl[3],
color_med_atl[4]))
p1<-p
p<-ggplot(data=data_pca,aes(x=PC3,y=PC4,label=INDIV))+
theme_minimal()+
theme(panel.grid=element_blank(),
panel.border=element_rect(fill="transparent"),
plot.title=element_text(hjust=0.5))+
geom_hline(yintercept=0,lty=2)+
geom_vline(xintercept=0,lty=2)+
geom_point(size=3,aes(col=LOCA))+
xlab(paste("PCA 3 (",round(pca$varprop[3]*100,2),"% )",sep=""))+
ylab(paste("PCA 4 (",round(pca$varprop[4]*100,2),"% )",sep=""))+
scale_colour_manual(name="Location",
values=c(color_med_atl[2],
color_med_atl[1],
color_med_atl[3],
color_med_atl[4]))
p2<-p
data_varpop=data.frame(PC=factor(paste("P",seq(1,10),sep=""),levels=paste("P",seq(1,10),sep="")),VAR=pca$varprop[1:10])
pp<-ggplot(data_varpop,aes(x=PC,y=VAR))+
geom_bar(stat='identity',fill="dodgerblue2",alpha=0.25)+
theme_classic()+
xlab("Principal Component")+
ylab("Variation explained (%)")
```
```{r}
subplot(ggplotly(p1)%>% layout(legend = list(orientation = "h", x = 0.2, y =-0.15)), ggplotly(p2)%>%hide_legend(), ggplotly(pp)%>%hide_legend(), titleX=T,titleY=T,margin=0.035,widths=c(0.375,0.425,0.2),which_layout=1) %>% partial_bundle()
```
### maf = 0.15
```{r}
pca=PCA_list$All_unfiltered$maf0.15[[1]]
data_pca=data.frame(INDIV=pca$sample.id,
PC1=pca$eigenvect[,1],
PC2=pca$eigenvect[,2],
PC3=pca$eigenvect[,3],
PC4=pca$eigenvect[,4],
LOCA=c(rep("Algarve",5),
rep("Bay of Biscay",5),
rep("Gulf of Lion",5),
rep("Costa Calida",5)))
color_med_atl=rev(brewer.pal(n=4,name="RdBu"))
p<-ggplot(data=data_pca,aes(x=PC1,y=PC2,label=INDIV))+
theme_minimal()+
theme(panel.grid=element_blank(),
panel.border=element_rect(fill="transparent"),
plot.title=element_text(hjust=0.5))+
geom_hline(yintercept=0,lty=2)+
geom_vline(xintercept=0,lty=2)+
geom_point(size=3,aes(col=LOCA))+
xlab(paste("PCA 1 (",round(pca$varprop[1]*100,2),"% )",sep=""))+
ylab(paste("PCA 2 (",round(pca$varprop[2]*100,2),"% )",sep=""))+
scale_colour_manual(name="Location",
values=c(color_med_atl[2],
color_med_atl[1],
color_med_atl[3],
color_med_atl[4]))
p1<-p
p<-ggplot(data=data_pca,aes(x=PC3,y=PC4,label=INDIV))+
theme_minimal()+
theme(panel.grid=element_blank(),
panel.border=element_rect(fill="transparent"),
plot.title=element_text(hjust=0.5))+
geom_hline(yintercept=0,lty=2)+
geom_vline(xintercept=0,lty=2)+
geom_point(size=3,aes(col=LOCA))+
xlab(paste("PCA 3 (",round(pca$varprop[3]*100,2),"% )",sep=""))+
ylab(paste("PCA 4 (",round(pca$varprop[4]*100,2),"% )",sep=""))+
scale_colour_manual(name="Location",
values=c(color_med_atl[2],
color_med_atl[1],
color_med_atl[3],
color_med_atl[4]))
p2<-p
data_varpop=data.frame(PC=factor(paste("P",seq(1,10),sep=""),levels=paste("P",seq(1,10),sep="")),VAR=pca$varprop[1:10])
pp<-ggplot(data_varpop,aes(x=PC,y=VAR))+
geom_bar(stat='identity',fill="dodgerblue2",alpha=0.25)+
theme_classic()+
xlab("Principal Component")+
ylab("Variation explained (%)")
```
```{r}
subplot(ggplotly(p1)%>% layout(legend = list(orientation = "h", x = 0.2, y =-0.15)), ggplotly(p2)%>%hide_legend(), ggplotly(pp)%>%hide_legend(), titleX=T,titleY=T,margin=0.035,widths=c(0.375,0.425,0.2),which_layout=1) %>% partial_bundle()
```
### maf = 0.20
```{r}
pca=PCA_list$All_unfiltered$maf0.2[[1]]
data_pca=data.frame(INDIV=pca$sample.id,
PC1=pca$eigenvect[,1],
PC2=pca$eigenvect[,2],
PC3=pca$eigenvect[,3],
PC4=pca$eigenvect[,4],
LOCA=c(rep("Algarve",5),
rep("Bay of Biscay",5),
rep("Gulf of Lion",5),
rep("Costa Calida",5)))
color_med_atl=rev(brewer.pal(n=4,name="RdBu"))
p<-ggplot(data=data_pca,aes(x=PC1,y=PC2,label=INDIV))+
theme_minimal()+
theme(panel.grid=element_blank(),
panel.border=element_rect(fill="transparent"),
plot.title=element_text(hjust=0.5))+
geom_hline(yintercept=0,lty=2)+
geom_vline(xintercept=0,lty=2)+
geom_point(size=3,aes(col=LOCA))+
xlab(paste("PCA 1 (",round(pca$varprop[1]*100,2),"% )",sep=""))+
ylab(paste("PCA 2 (",round(pca$varprop[2]*100,2),"% )",sep=""))+
scale_colour_manual(name="Location",
values=c(color_med_atl[2],
color_med_atl[1],
color_med_atl[3],
color_med_atl[4]))
p1<-p
p<-ggplot(data=data_pca,aes(x=PC3,y=PC4,label=INDIV))+
theme_minimal()+
theme(panel.grid=element_blank(),
panel.border=element_rect(fill="transparent"),
plot.title=element_text(hjust=0.5))+
geom_hline(yintercept=0,lty=2)+
geom_vline(xintercept=0,lty=2)+
geom_point(size=3,aes(col=LOCA))+
xlab(paste("PCA 3 (",round(pca$varprop[3]*100,2),"% )",sep=""))+
ylab(paste("PCA 4 (",round(pca$varprop[4]*100,2),"% )",sep=""))+
scale_colour_manual(name="Location",
values=c(color_med_atl[2],
color_med_atl[1],
color_med_atl[3],
color_med_atl[4]))
p2<-p
data_varpop=data.frame(PC=factor(paste("P",seq(1,10),sep=""),levels=paste("P",seq(1,10),sep="")),VAR=pca$varprop[1:10])
pp<-ggplot(data_varpop,aes(x=PC,y=VAR))+
geom_bar(stat='identity',fill="dodgerblue2",alpha=0.25)+
theme_classic()+
xlab("Principal Component")+
ylab("Variation explained (%)")
```
```{r}
subplot(ggplotly(p1)%>% layout(legend = list(orientation = "h", x = 0.2, y =-0.15)), ggplotly(p2)%>%hide_legend(), ggplotly(pp)%>%hide_legend(), titleX=T,titleY=T,margin=0.035,widths=c(0.375,0.425,0.2),which_layout=1) %>% partial_bundle()
```
### maf = 0.25
```{r}
pca=PCA_list$All_unfiltered$maf0.25[[1]]
data_pca=data.frame(INDIV=pca$sample.id,
PC1=pca$eigenvect[,1],
PC2=pca$eigenvect[,2],
PC3=pca$eigenvect[,3],
PC4=pca$eigenvect[,4],
LOCA=c(rep("Algarve",5),
rep("Bay of Biscay",5),
rep("Gulf of Lion",5),
rep("Costa Calida",5)))
color_med_atl=rev(brewer.pal(n=4,name="RdBu"))
p<-ggplot(data=data_pca,aes(x=PC1,y=PC2,label=INDIV))+
theme_minimal()+
theme(panel.grid=element_blank(),
panel.border=element_rect(fill="transparent"),
plot.title=element_text(hjust=0.5))+
geom_hline(yintercept=0,lty=2)+
geom_vline(xintercept=0,lty=2)+
geom_point(size=3,aes(col=LOCA))+
xlab(paste("PCA 1 (",round(pca$varprop[1]*100,2),"% )",sep=""))+
ylab(paste("PCA 2 (",round(pca$varprop[2]*100,2),"% )",sep=""))+
scale_colour_manual(name="Location",
values=c(color_med_atl[2],
color_med_atl[1],
color_med_atl[3],
color_med_atl[4]))
p1<-p
p<-ggplot(data=data_pca,aes(x=PC3,y=PC4,label=INDIV))+
theme_minimal()+
theme(panel.grid=element_blank(),
panel.border=element_rect(fill="transparent"),
plot.title=element_text(hjust=0.5))+
geom_hline(yintercept=0,lty=2)+
geom_vline(xintercept=0,lty=2)+
geom_point(size=3,aes(col=LOCA))+
xlab(paste("PCA 3 (",round(pca$varprop[3]*100,2),"% )",sep=""))+
ylab(paste("PCA 4 (",round(pca$varprop[4]*100,2),"% )",sep=""))+
scale_colour_manual(name="Location",
values=c(color_med_atl[2],
color_med_atl[1],
color_med_atl[3],
color_med_atl[4]))
p2<-p
data_varpop=data.frame(PC=factor(paste("P",seq(1,10),sep=""),levels=paste("P",seq(1,10),sep="")),VAR=pca$varprop[1:10])
pp<-ggplot(data_varpop,aes(x=PC,y=VAR))+
geom_bar(stat='identity',fill="dodgerblue2",alpha=0.25)+
theme_classic()+
xlab("Principal Component")+
ylab("Variation explained (%)")
```
```{r}
subplot(ggplotly(p1)%>% layout(legend = list(orientation = "h", x = 0.2, y =-0.15)), ggplotly(p2)%>%hide_legend(), ggplotly(pp)%>%hide_legend(), titleX=T,titleY=T,margin=0.035,widths=c(0.375,0.425,0.2),which_layout=1) %>% partial_bundle()
```
### maf = 0.30
```{r}
pca=PCA_list$All_unfiltered$maf0.3[[1]]
data_pca=data.frame(INDIV=pca$sample.id,
PC1=pca$eigenvect[,1],
PC2=pca$eigenvect[,2],
PC3=pca$eigenvect[,3],
PC4=pca$eigenvect[,4],
LOCA=c(rep("Algarve",5),
rep("Bay of Biscay",5),
rep("Gulf of Lion",5),
rep("Costa Calida",5)))
color_med_atl=rev(brewer.pal(n=4,name="RdBu"))
p<-ggplot(data=data_pca,aes(x=PC1,y=PC2,label=INDIV))+
theme_minimal()+
theme(panel.grid=element_blank(),
panel.border=element_rect(fill="transparent"),
plot.title=element_text(hjust=0.5))+
geom_hline(yintercept=0,lty=2)+
geom_vline(xintercept=0,lty=2)+
geom_point(size=3,aes(col=LOCA))+
xlab(paste("PCA 1 (",round(pca$varprop[1]*100,2),"% )",sep=""))+
ylab(paste("PCA 2 (",round(pca$varprop[2]*100,2),"% )",sep=""))+
scale_colour_manual(name="Location",
values=c(color_med_atl[2],
color_med_atl[1],
color_med_atl[3],
color_med_atl[4]))
p1<-p
p<-ggplot(data=data_pca,aes(x=PC3,y=PC4,label=INDIV))+
theme_minimal()+
theme(panel.grid=element_blank(),
panel.border=element_rect(fill="transparent"),
plot.title=element_text(hjust=0.5))+
geom_hline(yintercept=0,lty=2)+
geom_vline(xintercept=0,lty=2)+
geom_point(size=3,aes(col=LOCA))+
xlab(paste("PCA 3 (",round(pca$varprop[3]*100,2),"% )",sep=""))+
ylab(paste("PCA 4 (",round(pca$varprop[4]*100,2),"% )",sep=""))+
scale_colour_manual(name="Location",
values=c(color_med_atl[2],
color_med_atl[1],
color_med_atl[3],
color_med_atl[4]))
p2<-p
data_varpop=data.frame(PC=factor(paste("P",seq(1,10),sep=""),levels=paste("P",seq(1,10),sep="")),VAR=pca$varprop[1:10])
pp<-ggplot(data_varpop,aes(x=PC,y=VAR))+
geom_bar(stat='identity',fill="dodgerblue2",alpha=0.25)+
theme_classic()+
xlab("Principal Component")+
ylab("Variation explained (%)")
```
```{r}
subplot(ggplotly(p1)%>% layout(legend = list(orientation = "h", x = 0.2, y =-0.15)), ggplotly(p2)%>%hide_legend(), ggplotly(pp)%>%hide_legend(), titleX=T,titleY=T,margin=0.035,widths=c(0.375,0.425,0.2),which_layout=1) %>% partial_bundle()
```
### maf = 0.35
```{r}
pca=PCA_list$All_unfiltered$maf0.35[[1]]
data_pca=data.frame(INDIV=pca$sample.id,
PC1=pca$eigenvect[,1],
PC2=pca$eigenvect[,2],
PC3=pca$eigenvect[,3],
PC4=pca$eigenvect[,4],
LOCA=c(rep("Algarve",5),
rep("Bay of Biscay",5),
rep("Gulf of Lion",5),
rep("Costa Calida",5)))
color_med_atl=rev(brewer.pal(n=4,name="RdBu"))
p<-ggplot(data=data_pca,aes(x=PC1,y=PC2,label=INDIV))+
theme_minimal()+
theme(panel.grid=element_blank(),
panel.border=element_rect(fill="transparent"),
plot.title=element_text(hjust=0.5))+
geom_hline(yintercept=0,lty=2)+
geom_vline(xintercept=0,lty=2)+
geom_point(size=3,aes(col=LOCA))+
xlab(paste("PCA 1 (",round(pca$varprop[1]*100,2),"% )",sep=""))+
ylab(paste("PCA 2 (",round(pca$varprop[2]*100,2),"% )",sep=""))+
scale_colour_manual(name="Location",
values=c(color_med_atl[2],
color_med_atl[1],
color_med_atl[3],
color_med_atl[4]))
p1<-p
p<-ggplot(data=data_pca,aes(x=PC3,y=PC4,label=INDIV))+
theme_minimal()+
theme(panel.grid=element_blank(),
panel.border=element_rect(fill="transparent"),
plot.title=element_text(hjust=0.5))+
geom_hline(yintercept=0,lty=2)+
geom_vline(xintercept=0,lty=2)+
geom_point(size=3,aes(col=LOCA))+
xlab(paste("PCA 3 (",round(pca$varprop[3]*100,2),"% )",sep=""))+
ylab(paste("PCA 4 (",round(pca$varprop[4]*100,2),"% )",sep=""))+
scale_colour_manual(name="Location",
values=c(color_med_atl[2],
color_med_atl[1],
color_med_atl[3],
color_med_atl[4]))
p2<-p
data_varpop=data.frame(PC=factor(paste("P",seq(1,10),sep=""),levels=paste("P",seq(1,10),sep="")),VAR=pca$varprop[1:10])
pp<-ggplot(data_varpop,aes(x=PC,y=VAR))+
geom_bar(stat='identity',fill="dodgerblue2",alpha=0.25)+
theme_classic()+
xlab("Principal Component")+
ylab("Variation explained (%)")
```
```{r}
subplot(ggplotly(p1)%>% layout(legend = list(orientation = "h", x = 0.2, y =-0.15)), ggplotly(p2)%>%hide_legend(), ggplotly(pp)%>%hide_legend(), titleX=T,titleY=T,margin=0.035,widths=c(0.375,0.425,0.2),which_layout=1) %>% partial_bundle()
```
### maf = 0.40
```{r}
pca=PCA_list$All_unfiltered$maf0.4[[1]]
data_pca=data.frame(INDIV=pca$sample.id,
PC1=pca$eigenvect[,1],
PC2=pca$eigenvect[,2],
PC3=pca$eigenvect[,3],
PC4=pca$eigenvect[,4],
LOCA=c(rep("Algarve",5),
rep("Bay of Biscay",5),
rep("Gulf of Lion",5),
rep("Costa Calida",5)))
color_med_atl=rev(brewer.pal(n=4,name="RdBu"))
p<-ggplot(data=data_pca,aes(x=PC1,y=PC2,label=INDIV))+
theme_minimal()+
theme(panel.grid=element_blank(),
panel.border=element_rect(fill="transparent"),
plot.title=element_text(hjust=0.5))+
geom_hline(yintercept=0,lty=2)+
geom_vline(xintercept=0,lty=2)+
geom_point(size=3,aes(col=LOCA))+
xlab(paste("PCA 1 (",round(pca$varprop[1]*100,2),"% )",sep=""))+
ylab(paste("PCA 2 (",round(pca$varprop[2]*100,2),"% )",sep=""))+
scale_colour_manual(name="Location",
values=c(color_med_atl[2],
color_med_atl[1],
color_med_atl[3],
color_med_atl[4]))
p1<-p
p<-ggplot(data=data_pca,aes(x=PC3,y=PC4,label=INDIV))+
theme_minimal()+
theme(panel.grid=element_blank(),
panel.border=element_rect(fill="transparent"),
plot.title=element_text(hjust=0.5))+
geom_hline(yintercept=0,lty=2)+
geom_vline(xintercept=0,lty=2)+
geom_point(size=3,aes(col=LOCA))+
xlab(paste("PCA 3 (",round(pca$varprop[3]*100,2),"% )",sep=""))+
ylab(paste("PCA 4 (",round(pca$varprop[4]*100,2),"% )",sep=""))+
scale_colour_manual(name="Location",
values=c(color_med_atl[2],
color_med_atl[1],
color_med_atl[3],
color_med_atl[4]))
p2<-p
data_varpop=data.frame(PC=factor(paste("P",seq(1,10),sep=""),levels=paste("P",seq(1,10),sep="")),VAR=pca$varprop[1:10])
pp<-ggplot(data_varpop,aes(x=PC,y=VAR))+
geom_bar(stat='identity',fill="dodgerblue2",alpha=0.25)+
theme_classic()+
xlab("Principal Component")+
ylab("Variation explained (%)")
```
```{r}
subplot(ggplotly(p1)%>% layout(legend = list(orientation = "h", x = 0.2, y =-0.15)), ggplotly(p2)%>%hide_legend(), ggplotly(pp)%>%hide_legend(), titleX=T,titleY=T,margin=0.035,widths=c(0.375,0.425,0.2),which_layout=1) %>% partial_bundle()
```
### maf = 0.45
```{r}
pca=PCA_list$All_unfiltered$maf0.45[[1]]
data_pca=data.frame(INDIV=pca$sample.id,
PC1=pca$eigenvect[,1],
PC2=pca$eigenvect[,2],
PC3=pca$eigenvect[,3],
PC4=pca$eigenvect[,4],
LOCA=c(rep("Algarve",5),
rep("Bay of Biscay",5),
rep("Gulf of Lion",5),
rep("Costa Calida",5)))
color_med_atl=rev(brewer.pal(n=4,name="RdBu"))
p<-ggplot(data=data_pca,aes(x=PC1,y=PC2,label=INDIV))+
theme_minimal()+
theme(panel.grid=element_blank(),
panel.border=element_rect(fill="transparent"),
plot.title=element_text(hjust=0.5))+
geom_hline(yintercept=0,lty=2)+
geom_vline(xintercept=0,lty=2)+
geom_point(size=3,aes(col=LOCA))+
xlab(paste("PCA 1 (",round(pca$varprop[1]*100,2),"% )",sep=""))+
ylab(paste("PCA 2 (",round(pca$varprop[2]*100,2),"% )",sep=""))+
scale_colour_manual(name="Location",
values=c(color_med_atl[2],
color_med_atl[1],
color_med_atl[3],
color_med_atl[4]))
p1<-p
p<-ggplot(data=data_pca,aes(x=PC3,y=PC4,label=INDIV))+
theme_minimal()+
theme(panel.grid=element_blank(),
panel.border=element_rect(fill="transparent"),
plot.title=element_text(hjust=0.5))+
geom_hline(yintercept=0,lty=2)+
geom_vline(xintercept=0,lty=2)+
geom_point(size=3,aes(col=LOCA))+
xlab(paste("PCA 3 (",round(pca$varprop[3]*100,2),"% )",sep=""))+
ylab(paste("PCA 4 (",round(pca$varprop[4]*100,2),"% )",sep=""))+
scale_colour_manual(name="Location",
values=c(color_med_atl[2],
color_med_atl[1],
color_med_atl[3],
color_med_atl[4]))
p2<-p
data_varpop=data.frame(PC=factor(paste("P",seq(1,10),sep=""),levels=paste("P",seq(1,10),sep="")),VAR=pca$varprop[1:10])
pp<-ggplot(data_varpop,aes(x=PC,y=VAR))+
geom_bar(stat='identity',fill="dodgerblue2",alpha=0.25)+
theme_classic()+
xlab("Principal Component")+
ylab("Variation explained (%)")
```
```{r}
subplot(ggplotly(p1)%>% layout(legend = list(orientation = "h", x = 0.2, y =-0.15)), ggplotly(p2)%>%hide_legend(), ggplotly(pp)%>%hide_legend(), titleX=T,titleY=T,margin=0.035,widths=c(0.375,0.425,0.2),which_layout=1) %>% partial_bundle()
```
### maf = 0.50
```{r}
pca=PCA_list$All_unfiltered$maf0.5[[1]]
data_pca=data.frame(INDIV=pca$sample.id,
PC1=pca$eigenvect[,1],
PC2=pca$eigenvect[,2],
PC3=pca$eigenvect[,3],
PC4=pca$eigenvect[,4],
LOCA=c(rep("Algarve",5),
rep("Bay of Biscay",5),
rep("Gulf of Lion",5),
rep("Costa Calida",5)))
color_med_atl=rev(brewer.pal(n=4,name="RdBu"))
p<-ggplot(data=data_pca,aes(x=PC1,y=PC2,label=INDIV))+
theme_minimal()+
theme(panel.grid=element_blank(),
panel.border=element_rect(fill="transparent"),
plot.title=element_text(hjust=0.5))+
geom_hline(yintercept=0,lty=2)+
geom_vline(xintercept=0,lty=2)+
geom_point(size=3,aes(col=LOCA))+
xlab(paste("PCA 1 (",round(pca$varprop[1]*100,2),"% )",sep=""))+
ylab(paste("PCA 2 (",round(pca$varprop[2]*100,2),"% )",sep=""))+
scale_colour_manual(name="Location",
values=c(color_med_atl[2],
color_med_atl[1],
color_med_atl[3],
color_med_atl[4]))
p1<-p
p<-ggplot(data=data_pca,aes(x=PC3,y=PC4,label=INDIV))+
theme_minimal()+
theme(panel.grid=element_blank(),
panel.border=element_rect(fill="transparent"),
plot.title=element_text(hjust=0.5))+
geom_hline(yintercept=0,lty=2)+
geom_vline(xintercept=0,lty=2)+
geom_point(size=3,aes(col=LOCA))+
xlab(paste("PCA 3 (",round(pca$varprop[3]*100,2),"% )",sep=""))+
ylab(paste("PCA 4 (",round(pca$varprop[4]*100,2),"% )",sep=""))+
scale_colour_manual(name="Location",
values=c(color_med_atl[2],
color_med_atl[1],
color_med_atl[3],
color_med_atl[4]))
p2<-p
data_varpop=data.frame(PC=factor(paste("P",seq(1,10),sep=""),levels=paste("P",seq(1,10),sep="")),VAR=pca$varprop[1:10])
pp<-ggplot(data_varpop,aes(x=PC,y=VAR))+
geom_bar(stat='identity',fill="dodgerblue2",alpha=0.25)+
theme_classic()+
xlab("Principal Component")+
ylab("Variation explained (%)")
```
```{r}
subplot(ggplotly(p1)%>% layout(legend = list(orientation = "h", x = 0.2, y =-0.15)), ggplotly(p2)%>%hide_legend(), ggplotly(pp)%>%hide_legend(), titleX=T,titleY=T,margin=0.035,widths=c(0.375,0.425,0.2),which_layout=1) %>% partial_bundle()
```
Row {.tabset data-height=50}
-----------------------
<center>
<font size="6">**Pruned unfiltered SNPS**</font>
</center>
Row {.tabset data-height=600}
-----------------------
### maf = 0
```{r}
pca=PCA_list$Prune_unfiltered$maf0[[1]]
data_pca=data.frame(INDIV=pca$sample.id,
PC1=pca$eigenvect[,1],
PC2=pca$eigenvect[,2],
PC3=pca$eigenvect[,3],
PC4=pca$eigenvect[,4],
LOCA=c(rep("Algarve",5),
rep("Bay of Biscay",5),
rep("Gulf of Lion",5),
rep("Costa Calida",5)))
color_med_atl=rev(brewer.pal(n=4,name="RdBu"))
p<-ggplot(data=data_pca,aes(x=PC1,y=PC2,label=INDIV))+
theme_minimal()+
theme(panel.grid=element_blank(),
panel.border=element_rect(fill="transparent"),
plot.title=element_text(hjust=0.5))+
geom_hline(yintercept=0,lty=2)+
geom_vline(xintercept=0,lty=2)+
geom_point(size=3,aes(col=LOCA))+
xlab(paste("PCA 1 (",round(pca$varprop[1]*100,2),"% )",sep=""))+
ylab(paste("PCA 2 (",round(pca$varprop[2]*100,2),"% )",sep=""))+
scale_colour_manual(name="Location",
values=c(color_med_atl[2],
color_med_atl[1],
color_med_atl[3],
color_med_atl[4]))
p1<-p
p<-ggplot(data=data_pca,aes(x=PC3,y=PC4,label=INDIV))+
theme_minimal()+
theme(panel.grid=element_blank(),
panel.border=element_rect(fill="transparent"),
plot.title=element_text(hjust=0.5))+
geom_hline(yintercept=0,lty=2)+
geom_vline(xintercept=0,lty=2)+
geom_point(size=3,aes(col=LOCA))+
xlab(paste("PCA 3 (",round(pca$varprop[3]*100,2),"% )",sep=""))+
ylab(paste("PCA 4 (",round(pca$varprop[4]*100,2),"% )",sep=""))+
scale_colour_manual(name="Location",
values=c(color_med_atl[2],
color_med_atl[1],
color_med_atl[3],
color_med_atl[4]))
p2<-p
data_varpop=data.frame(PC=factor(paste("P",seq(1,10),sep=""),levels=paste("P",seq(1,10),sep="")),VAR=pca$varprop[1:10])
pp<-ggplot(data_varpop,aes(x=PC,y=VAR))+
geom_bar(stat='identity',fill="dodgerblue2",alpha=0.25)+
theme_classic()+
xlab("Principal Component")+
ylab("Variation explained (%)")
```
```{r}
subplot(ggplotly(p1)%>% layout(legend = list(orientation = "h", x = 0.2, y =-0.15)), ggplotly(p2)%>%hide_legend(), ggplotly(pp)%>%hide_legend(), titleX=T,titleY=T,margin=0.035,widths=c(0.375,0.425,0.2),which_layout=1) %>% partial_bundle()
```
### maf = 0.05
```{r}
pca=PCA_list$Prune_unfiltered$maf0.05[[1]]
data_pca=data.frame(INDIV=pca$sample.id,
PC1=pca$eigenvect[,1],
PC2=pca$eigenvect[,2],
PC3=pca$eigenvect[,3],
PC4=pca$eigenvect[,4],
LOCA=c(rep("Algarve",5),
rep("Bay of Biscay",5),
rep("Gulf of Lion",5),
rep("Costa Calida",5)))
color_med_atl=rev(brewer.pal(n=4,name="RdBu"))
p<-ggplot(data=data_pca,aes(x=PC1,y=PC2,label=INDIV))+
theme_minimal()+
theme(panel.grid=element_blank(),
panel.border=element_rect(fill="transparent"),
plot.title=element_text(hjust=0.5))+
geom_hline(yintercept=0,lty=2)+
geom_vline(xintercept=0,lty=2)+
geom_point(size=3,aes(col=LOCA))+
xlab(paste("PCA 1 (",round(pca$varprop[1]*100,2),"% )",sep=""))+
ylab(paste("PCA 2 (",round(pca$varprop[2]*100,2),"% )",sep=""))+
scale_colour_manual(name="Location",
values=c(color_med_atl[2],
color_med_atl[1],
color_med_atl[3],
color_med_atl[4]))
p1<-p
p<-ggplot(data=data_pca,aes(x=PC3,y=PC4,label=INDIV))+
theme_minimal()+
theme(panel.grid=element_blank(),
panel.border=element_rect(fill="transparent"),
plot.title=element_text(hjust=0.5))+
geom_hline(yintercept=0,lty=2)+
geom_vline(xintercept=0,lty=2)+
geom_point(size=3,aes(col=LOCA))+
xlab(paste("PCA 3 (",round(pca$varprop[3]*100,2),"% )",sep=""))+
ylab(paste("PCA 4 (",round(pca$varprop[4]*100,2),"% )",sep=""))+
scale_colour_manual(name="Location",
values=c(color_med_atl[2],
color_med_atl[1],
color_med_atl[3],
color_med_atl[4]))
p2<-p
data_varpop=data.frame(PC=factor(paste("P",seq(1,10),sep=""),levels=paste("P",seq(1,10),sep="")),VAR=pca$varprop[1:10])
pp<-ggplot(data_varpop,aes(x=PC,y=VAR))+
geom_bar(stat='identity',fill="dodgerblue2",alpha=0.25)+
theme_classic()+
xlab("Principal Component")+
ylab("Variation explained (%)")
```
```{r}
subplot(ggplotly(p1)%>% layout(legend = list(orientation = "h", x = 0.2, y =-0.15)), ggplotly(p2)%>%hide_legend(), ggplotly(pp)%>%hide_legend(), titleX=T,titleY=T,margin=0.035,widths=c(0.375,0.425,0.2),which_layout=1) %>% partial_bundle()
```
### maf = 0.1
```{r}
pca=PCA_list$Prune_unfiltered$maf0.1[[1]]
data_pca=data.frame(INDIV=pca$sample.id,
PC1=pca$eigenvect[,1],
PC2=pca$eigenvect[,2],
PC3=pca$eigenvect[,3],
PC4=pca$eigenvect[,4],
LOCA=c(rep("Algarve",5),
rep("Bay of Biscay",5),
rep("Gulf of Lion",5),
rep("Costa Calida",5)))
color_med_atl=rev(brewer.pal(n=4,name="RdBu"))
p<-ggplot(data=data_pca,aes(x=PC1,y=PC2,label=INDIV))+
theme_minimal()+
theme(panel.grid=element_blank(),
panel.border=element_rect(fill="transparent"),
plot.title=element_text(hjust=0.5))+
geom_hline(yintercept=0,lty=2)+
geom_vline(xintercept=0,lty=2)+
geom_point(size=3,aes(col=LOCA))+
xlab(paste("PCA 1 (",round(pca$varprop[1]*100,2),"% )",sep=""))+
ylab(paste("PCA 2 (",round(pca$varprop[2]*100,2),"% )",sep=""))+
scale_colour_manual(name="Location",
values=c(color_med_atl[2],
color_med_atl[1],
color_med_atl[3],
color_med_atl[4]))
p1<-p
p<-ggplot(data=data_pca,aes(x=PC3,y=PC4,label=INDIV))+
theme_minimal()+
theme(panel.grid=element_blank(),
panel.border=element_rect(fill="transparent"),
plot.title=element_text(hjust=0.5))+
geom_hline(yintercept=0,lty=2)+
geom_vline(xintercept=0,lty=2)+
geom_point(size=3,aes(col=LOCA))+
xlab(paste("PCA 3 (",round(pca$varprop[3]*100,2),"% )",sep=""))+
ylab(paste("PCA 4 (",round(pca$varprop[4]*100,2),"% )",sep=""))+
scale_colour_manual(name="Location",
values=c(color_med_atl[2],
color_med_atl[1],
color_med_atl[3],
color_med_atl[4]))
p2<-p
data_varpop=data.frame(PC=factor(paste("P",seq(1,10),sep=""),levels=paste("P",seq(1,10),sep="")),VAR=pca$varprop[1:10])
pp<-ggplot(data_varpop,aes(x=PC,y=VAR))+
geom_bar(stat='identity',fill="dodgerblue2",alpha=0.25)+
theme_classic()+
xlab("Principal Component")+
ylab("Variation explained (%)")
```
```{r}
subplot(ggplotly(p1)%>% layout(legend = list(orientation = "h", x = 0.2, y =-0.15)), ggplotly(p2)%>%hide_legend(), ggplotly(pp)%>%hide_legend(), titleX=T,titleY=T,margin=0.035,widths=c(0.375,0.425,0.2),which_layout=1) %>% partial_bundle()
```
### maf = 0.15
```{r}
pca=PCA_list$Prune_unfiltered$maf0.15[[1]]
data_pca=data.frame(INDIV=pca$sample.id,
PC1=pca$eigenvect[,1],
PC2=pca$eigenvect[,2],
PC3=pca$eigenvect[,3],
PC4=pca$eigenvect[,4],
LOCA=c(rep("Algarve",5),
rep("Bay of Biscay",5),
rep("Gulf of Lion",5),
rep("Costa Calida",5)))
color_med_atl=rev(brewer.pal(n=4,name="RdBu"))
p<-ggplot(data=data_pca,aes(x=PC1,y=PC2,label=INDIV))+
theme_minimal()+
theme(panel.grid=element_blank(),
panel.border=element_rect(fill="transparent"),
plot.title=element_text(hjust=0.5))+
geom_hline(yintercept=0,lty=2)+
geom_vline(xintercept=0,lty=2)+
geom_point(size=3,aes(col=LOCA))+
xlab(paste("PCA 1 (",round(pca$varprop[1]*100,2),"% )",sep=""))+
ylab(paste("PCA 2 (",round(pca$varprop[2]*100,2),"% )",sep=""))+
scale_colour_manual(name="Location",
values=c(color_med_atl[2],
color_med_atl[1],
color_med_atl[3],
color_med_atl[4]))
p1<-p
p<-ggplot(data=data_pca,aes(x=PC3,y=PC4,label=INDIV))+
theme_minimal()+
theme(panel.grid=element_blank(),
panel.border=element_rect(fill="transparent"),
plot.title=element_text(hjust=0.5))+
geom_hline(yintercept=0,lty=2)+
geom_vline(xintercept=0,lty=2)+
geom_point(size=3,aes(col=LOCA))+
xlab(paste("PCA 3 (",round(pca$varprop[3]*100,2),"% )",sep=""))+
ylab(paste("PCA 4 (",round(pca$varprop[4]*100,2),"% )",sep=""))+
scale_colour_manual(name="Location",
values=c(color_med_atl[2],
color_med_atl[1],
color_med_atl[3],
color_med_atl[4]))
p2<-p
data_varpop=data.frame(PC=factor(paste("P",seq(1,10),sep=""),levels=paste("P",seq(1,10),sep="")),VAR=pca$varprop[1:10])
pp<-ggplot(data_varpop,aes(x=PC,y=VAR))+
geom_bar(stat='identity',fill="dodgerblue2",alpha=0.25)+
theme_classic()+
xlab("Principal Component")+
ylab("Variation explained (%)")
```
```{r}
subplot(ggplotly(p1)%>% layout(legend = list(orientation = "h", x = 0.2, y =-0.15)), ggplotly(p2)%>%hide_legend(), ggplotly(pp)%>%hide_legend(), titleX=T,titleY=T,margin=0.035,widths=c(0.375,0.425,0.2),which_layout=1) %>% partial_bundle()
```
### maf = 0.20
```{r}
pca=PCA_list$Prune_unfiltered$maf0.2[[1]]
data_pca=data.frame(INDIV=pca$sample.id,
PC1=pca$eigenvect[,1],
PC2=pca$eigenvect[,2],
PC3=pca$eigenvect[,3],
PC4=pca$eigenvect[,4],
LOCA=c(rep("Algarve",5),
rep("Bay of Biscay",5),
rep("Gulf of Lion",5),
rep("Costa Calida",5)))
color_med_atl=rev(brewer.pal(n=4,name="RdBu"))
p<-ggplot(data=data_pca,aes(x=PC1,y=PC2,label=INDIV))+
theme_minimal()+
theme(panel.grid=element_blank(),
panel.border=element_rect(fill="transparent"),
plot.title=element_text(hjust=0.5))+
geom_hline(yintercept=0,lty=2)+
geom_vline(xintercept=0,lty=2)+
geom_point(size=3,aes(col=LOCA))+
xlab(paste("PCA 1 (",round(pca$varprop[1]*100,2),"% )",sep=""))+
ylab(paste("PCA 2 (",round(pca$varprop[2]*100,2),"% )",sep=""))+
scale_colour_manual(name="Location",
values=c(color_med_atl[2],
color_med_atl[1],
color_med_atl[3],
color_med_atl[4]))
p1<-p
p<-ggplot(data=data_pca,aes(x=PC3,y=PC4,label=INDIV))+
theme_minimal()+
theme(panel.grid=element_blank(),
panel.border=element_rect(fill="transparent"),
plot.title=element_text(hjust=0.5))+
geom_hline(yintercept=0,lty=2)+
geom_vline(xintercept=0,lty=2)+
geom_point(size=3,aes(col=LOCA))+
xlab(paste("PCA 3 (",round(pca$varprop[3]*100,2),"% )",sep=""))+
ylab(paste("PCA 4 (",round(pca$varprop[4]*100,2),"% )",sep=""))+
scale_colour_manual(name="Location",
values=c(color_med_atl[2],
color_med_atl[1],
color_med_atl[3],
color_med_atl[4]))
p2<-p
data_varpop=data.frame(PC=factor(paste("P",seq(1,10),sep=""),levels=paste("P",seq(1,10),sep="")),VAR=pca$varprop[1:10])
pp<-ggplot(data_varpop,aes(x=PC,y=VAR))+
geom_bar(stat='identity',fill="dodgerblue2",alpha=0.25)+
theme_classic()+
xlab("Principal Component")+
ylab("Variation explained (%)")
```
```{r}
subplot(ggplotly(p1)%>% layout(legend = list(orientation = "h", x = 0.2, y =-0.15)), ggplotly(p2)%>%hide_legend(), ggplotly(pp)%>%hide_legend(), titleX=T,titleY=T,margin=0.035,widths=c(0.375,0.425,0.2),which_layout=1) %>% partial_bundle()
```
### maf = 0.25
```{r}
pca=PCA_list$Prune_unfiltered$maf0.25[[1]]
data_pca=data.frame(INDIV=pca$sample.id,
PC1=pca$eigenvect[,1],
PC2=pca$eigenvect[,2],
PC3=pca$eigenvect[,3],
PC4=pca$eigenvect[,4],
LOCA=c(rep("Algarve",5),
rep("Bay of Biscay",5),
rep("Gulf of Lion",5),
rep("Costa Calida",5)))
color_med_atl=rev(brewer.pal(n=4,name="RdBu"))
p<-ggplot(data=data_pca,aes(x=PC1,y=PC2,label=INDIV))+
theme_minimal()+
theme(panel.grid=element_blank(),
panel.border=element_rect(fill="transparent"),
plot.title=element_text(hjust=0.5))+
geom_hline(yintercept=0,lty=2)+
geom_vline(xintercept=0,lty=2)+
geom_point(size=3,aes(col=LOCA))+
xlab(paste("PCA 1 (",round(pca$varprop[1]*100,2),"% )",sep=""))+
ylab(paste("PCA 2 (",round(pca$varprop[2]*100,2),"% )",sep=""))+
scale_colour_manual(name="Location",
values=c(color_med_atl[2],
color_med_atl[1],
color_med_atl[3],
color_med_atl[4]))
p1<-p
p<-ggplot(data=data_pca,aes(x=PC3,y=PC4,label=INDIV))+
theme_minimal()+
theme(panel.grid=element_blank(),
panel.border=element_rect(fill="transparent"),
plot.title=element_text(hjust=0.5))+
geom_hline(yintercept=0,lty=2)+
geom_vline(xintercept=0,lty=2)+
geom_point(size=3,aes(col=LOCA))+
xlab(paste("PCA 3 (",round(pca$varprop[3]*100,2),"% )",sep=""))+
ylab(paste("PCA 4 (",round(pca$varprop[4]*100,2),"% )",sep=""))+
scale_colour_manual(name="Location",
values=c(color_med_atl[2],
color_med_atl[1],
color_med_atl[3],
color_med_atl[4]))
p2<-p
data_varpop=data.frame(PC=factor(paste("P",seq(1,10),sep=""),levels=paste("P",seq(1,10),sep="")),VAR=pca$varprop[1:10])
pp<-ggplot(data_varpop,aes(x=PC,y=VAR))+
geom_bar(stat='identity',fill="dodgerblue2",alpha=0.25)+
theme_classic()+
xlab("Principal Component")+
ylab("Variation explained (%)")
```
```{r}
subplot(ggplotly(p1)%>% layout(legend = list(orientation = "h", x = 0.2, y =-0.15)), ggplotly(p2)%>%hide_legend(), ggplotly(pp)%>%hide_legend(), titleX=T,titleY=T,margin=0.035,widths=c(0.375,0.425,0.2),which_layout=1) %>% partial_bundle()
```
### maf = 0.30
```{r}
pca=PCA_list$Prune_unfiltered$maf0.3[[1]]
data_pca=data.frame(INDIV=pca$sample.id,
PC1=pca$eigenvect[,1],
PC2=pca$eigenvect[,2],
PC3=pca$eigenvect[,3],
PC4=pca$eigenvect[,4],
LOCA=c(rep("Algarve",5),
rep("Bay of Biscay",5),
rep("Gulf of Lion",5),
rep("Costa Calida",5)))
color_med_atl=rev(brewer.pal(n=4,name="RdBu"))
p<-ggplot(data=data_pca,aes(x=PC1,y=PC2,label=INDIV))+
theme_minimal()+
theme(panel.grid=element_blank(),
panel.border=element_rect(fill="transparent"),
plot.title=element_text(hjust=0.5))+
geom_hline(yintercept=0,lty=2)+
geom_vline(xintercept=0,lty=2)+
geom_point(size=3,aes(col=LOCA))+
xlab(paste("PCA 1 (",round(pca$varprop[1]*100,2),"% )",sep=""))+
ylab(paste("PCA 2 (",round(pca$varprop[2]*100,2),"% )",sep=""))+
scale_colour_manual(name="Location",
values=c(color_med_atl[2],
color_med_atl[1],
color_med_atl[3],
color_med_atl[4]))
p1<-p
p<-ggplot(data=data_pca,aes(x=PC3,y=PC4,label=INDIV))+
theme_minimal()+
theme(panel.grid=element_blank(),
panel.border=element_rect(fill="transparent"),
plot.title=element_text(hjust=0.5))+
geom_hline(yintercept=0,lty=2)+
geom_vline(xintercept=0,lty=2)+
geom_point(size=3,aes(col=LOCA))+
xlab(paste("PCA 3 (",round(pca$varprop[3]*100,2),"% )",sep=""))+
ylab(paste("PCA 4 (",round(pca$varprop[4]*100,2),"% )",sep=""))+
scale_colour_manual(name="Location",
values=c(color_med_atl[2],
color_med_atl[1],
color_med_atl[3],
color_med_atl[4]))
p2<-p
data_varpop=data.frame(PC=factor(paste("P",seq(1,10),sep=""),levels=paste("P",seq(1,10),sep="")),VAR=pca$varprop[1:10])
pp<-ggplot(data_varpop,aes(x=PC,y=VAR))+
geom_bar(stat='identity',fill="dodgerblue2",alpha=0.25)+
theme_classic()+
xlab("Principal Component")+
ylab("Variation explained (%)")
```
```{r}
subplot(ggplotly(p1)%>% layout(legend = list(orientation = "h", x = 0.2, y =-0.15)), ggplotly(p2)%>%hide_legend(), ggplotly(pp)%>%hide_legend(), titleX=T,titleY=T,margin=0.035,widths=c(0.375,0.425,0.2),which_layout=1) %>% partial_bundle()
```
### maf = 0.35
```{r}
pca=PCA_list$Prune_unfiltered$maf0.35[[1]]
data_pca=data.frame(INDIV=pca$sample.id,
PC1=pca$eigenvect[,1],
PC2=pca$eigenvect[,2],
PC3=pca$eigenvect[,3],
PC4=pca$eigenvect[,4],
LOCA=c(rep("Algarve",5),
rep("Bay of Biscay",5),
rep("Gulf of Lion",5),
rep("Costa Calida",5)))
color_med_atl=rev(brewer.pal(n=4,name="RdBu"))
p<-ggplot(data=data_pca,aes(x=PC1,y=PC2,label=INDIV))+
theme_minimal()+
theme(panel.grid=element_blank(),
panel.border=element_rect(fill="transparent"),
plot.title=element_text(hjust=0.5))+
geom_hline(yintercept=0,lty=2)+
geom_vline(xintercept=0,lty=2)+
geom_point(size=3,aes(col=LOCA))+
xlab(paste("PCA 1 (",round(pca$varprop[1]*100,2),"% )",sep=""))+
ylab(paste("PCA 2 (",round(pca$varprop[2]*100,2),"% )",sep=""))+
scale_colour_manual(name="Location",
values=c(color_med_atl[2],
color_med_atl[1],
color_med_atl[3],
color_med_atl[4]))
p1<-p
p<-ggplot(data=data_pca,aes(x=PC3,y=PC4,label=INDIV))+
theme_minimal()+
theme(panel.grid=element_blank(),
panel.border=element_rect(fill="transparent"),
plot.title=element_text(hjust=0.5))+
geom_hline(yintercept=0,lty=2)+
geom_vline(xintercept=0,lty=2)+
geom_point(size=3,aes(col=LOCA))+
xlab(paste("PCA 3 (",round(pca$varprop[3]*100,2),"% )",sep=""))+
ylab(paste("PCA 4 (",round(pca$varprop[4]*100,2),"% )",sep=""))+
scale_colour_manual(name="Location",
values=c(color_med_atl[2],
color_med_atl[1],
color_med_atl[3],
color_med_atl[4]))
p2<-p
data_varpop=data.frame(PC=factor(paste("P",seq(1,10),sep=""),levels=paste("P",seq(1,10),sep="")),VAR=pca$varprop[1:10])
pp<-ggplot(data_varpop,aes(x=PC,y=VAR))+
geom_bar(stat='identity',fill="dodgerblue2",alpha=0.25)+
theme_classic()+
xlab("Principal Component")+
ylab("Variation explained (%)")
```
```{r}
subplot(ggplotly(p1)%>% layout(legend = list(orientation = "h", x = 0.2, y =-0.15)), ggplotly(p2)%>%hide_legend(), ggplotly(pp)%>%hide_legend(), titleX=T,titleY=T,margin=0.035,widths=c(0.375,0.425,0.2),which_layout=1) %>% partial_bundle()
```
### maf = 0.40
```{r}
pca=PCA_list$Prune_unfiltered$maf0.4[[1]]
data_pca=data.frame(INDIV=pca$sample.id,
PC1=pca$eigenvect[,1],
PC2=pca$eigenvect[,2],
PC3=pca$eigenvect[,3],
PC4=pca$eigenvect[,4],
LOCA=c(rep("Algarve",5),
rep("Bay of Biscay",5),
rep("Gulf of Lion",5),
rep("Costa Calida",5)))
color_med_atl=rev(brewer.pal(n=4,name="RdBu"))
p<-ggplot(data=data_pca,aes(x=PC1,y=PC2,label=INDIV))+
theme_minimal()+
theme(panel.grid=element_blank(),
panel.border=element_rect(fill="transparent"),
plot.title=element_text(hjust=0.5))+
geom_hline(yintercept=0,lty=2)+
geom_vline(xintercept=0,lty=2)+
geom_point(size=3,aes(col=LOCA))+
xlab(paste("PCA 1 (",round(pca$varprop[1]*100,2),"% )",sep=""))+
ylab(paste("PCA 2 (",round(pca$varprop[2]*100,2),"% )",sep=""))+
scale_colour_manual(name="Location",
values=c(color_med_atl[2],
color_med_atl[1],
color_med_atl[3],
color_med_atl[4]))
p1<-p
p<-ggplot(data=data_pca,aes(x=PC3,y=PC4,label=INDIV))+
theme_minimal()+
theme(panel.grid=element_blank(),
panel.border=element_rect(fill="transparent"),
plot.title=element_text(hjust=0.5))+
geom_hline(yintercept=0,lty=2)+
geom_vline(xintercept=0,lty=2)+
geom_point(size=3,aes(col=LOCA))+
xlab(paste("PCA 3 (",round(pca$varprop[3]*100,2),"% )",sep=""))+
ylab(paste("PCA 4 (",round(pca$varprop[4]*100,2),"% )",sep=""))+
scale_colour_manual(name="Location",
values=c(color_med_atl[2],
color_med_atl[1],
color_med_atl[3],
color_med_atl[4]))
p2<-p
data_varpop=data.frame(PC=factor(paste("P",seq(1,10),sep=""),levels=paste("P",seq(1,10),sep="")),VAR=pca$varprop[1:10])
pp<-ggplot(data_varpop,aes(x=PC,y=VAR))+
geom_bar(stat='identity',fill="dodgerblue2",alpha=0.25)+
theme_classic()+
xlab("Principal Component")+
ylab("Variation explained (%)")
```
```{r}
subplot(ggplotly(p1)%>% layout(legend = list(orientation = "h", x = 0.2, y =-0.15)), ggplotly(p2)%>%hide_legend(), ggplotly(pp)%>%hide_legend(), titleX=T,titleY=T,margin=0.035,widths=c(0.375,0.425,0.2),which_layout=1) %>% partial_bundle()
```
### maf = 0.45
```{r}
pca=PCA_list$Prune_unfiltered$maf0.45[[1]]
data_pca=data.frame(INDIV=pca$sample.id,
PC1=pca$eigenvect[,1],
PC2=pca$eigenvect[,2],
PC3=pca$eigenvect[,3],
PC4=pca$eigenvect[,4],
LOCA=c(rep("Algarve",5),
rep("Bay of Biscay",5),
rep("Gulf of Lion",5),
rep("Costa Calida",5)))
color_med_atl=rev(brewer.pal(n=4,name="RdBu"))
p<-ggplot(data=data_pca,aes(x=PC1,y=PC2,label=INDIV))+
theme_minimal()+
theme(panel.grid=element_blank(),
panel.border=element_rect(fill="transparent"),
plot.title=element_text(hjust=0.5))+
geom_hline(yintercept=0,lty=2)+
geom_vline(xintercept=0,lty=2)+
geom_point(size=3,aes(col=LOCA))+
xlab(paste("PCA 1 (",round(pca$varprop[1]*100,2),"% )",sep=""))+
ylab(paste("PCA 2 (",round(pca$varprop[2]*100,2),"% )",sep=""))+
scale_colour_manual(name="Location",
values=c(color_med_atl[2],
color_med_atl[1],
color_med_atl[3],
color_med_atl[4]))
p1<-p
p<-ggplot(data=data_pca,aes(x=PC3,y=PC4,label=INDIV))+
theme_minimal()+
theme(panel.grid=element_blank(),
panel.border=element_rect(fill="transparent"),
plot.title=element_text(hjust=0.5))+
geom_hline(yintercept=0,lty=2)+
geom_vline(xintercept=0,lty=2)+
geom_point(size=3,aes(col=LOCA))+
xlab(paste("PCA 3 (",round(pca$varprop[3]*100,2),"% )",sep=""))+
ylab(paste("PCA 4 (",round(pca$varprop[4]*100,2),"% )",sep=""))+
scale_colour_manual(name="Location",
values=c(color_med_atl[2],
color_med_atl[1],
color_med_atl[3],
color_med_atl[4]))
p2<-p
data_varpop=data.frame(PC=factor(paste("P",seq(1,10),sep=""),levels=paste("P",seq(1,10),sep="")),VAR=pca$varprop[1:10])
pp<-ggplot(data_varpop,aes(x=PC,y=VAR))+
geom_bar(stat='identity',fill="dodgerblue2",alpha=0.25)+
theme_classic()+
xlab("Principal Component")+
ylab("Variation explained (%)")
```
```{r}
subplot(ggplotly(p1)%>% layout(legend = list(orientation = "h", x = 0.2, y =-0.15)), ggplotly(p2)%>%hide_legend(), ggplotly(pp)%>%hide_legend(), titleX=T,titleY=T,margin=0.035,widths=c(0.375,0.425,0.2),which_layout=1) %>% partial_bundle()
```
### maf = 0.50
```{r}
pca=PCA_list$Prune_unfiltered$maf0.5[[1]]
data_pca=data.frame(INDIV=pca$sample.id,
PC1=pca$eigenvect[,1],
PC2=pca$eigenvect[,2],
PC3=pca$eigenvect[,3],
PC4=pca$eigenvect[,4],
LOCA=c(rep("Algarve",5),
rep("Bay of Biscay",5),
rep("Gulf of Lion",5),
rep("Costa Calida",5)))
color_med_atl=rev(brewer.pal(n=4,name="RdBu"))
p<-ggplot(data=data_pca,aes(x=PC1,y=PC2,label=INDIV))+
theme_minimal()+
theme(panel.grid=element_blank(),
panel.border=element_rect(fill="transparent"),
plot.title=element_text(hjust=0.5))+
geom_hline(yintercept=0,lty=2)+
geom_vline(xintercept=0,lty=2)+
geom_point(size=3,aes(col=LOCA))+
xlab(paste("PCA 1 (",round(pca$varprop[1]*100,2),"% )",sep=""))+
ylab(paste("PCA 2 (",round(pca$varprop[2]*100,2),"% )",sep=""))+
scale_colour_manual(name="Location",
values=c(color_med_atl[2],
color_med_atl[1],
color_med_atl[3],
color_med_atl[4]))
p1<-p
p<-ggplot(data=data_pca,aes(x=PC3,y=PC4,label=INDIV))+
theme_minimal()+
theme(panel.grid=element_blank(),
panel.border=element_rect(fill="transparent"),
plot.title=element_text(hjust=0.5))+
geom_hline(yintercept=0,lty=2)+
geom_vline(xintercept=0,lty=2)+
geom_point(size=3,aes(col=LOCA))+
xlab(paste("PCA 3 (",round(pca$varprop[3]*100,2),"% )",sep=""))+
ylab(paste("PCA 4 (",round(pca$varprop[4]*100,2),"% )",sep=""))+
scale_colour_manual(name="Location",
values=c(color_med_atl[2],
color_med_atl[1],
color_med_atl[3],
color_med_atl[4]))
p2<-p
data_varpop=data.frame(PC=factor(paste("P",seq(1,10),sep=""),levels=paste("P",seq(1,10),sep="")),VAR=pca$varprop[1:10])
pp<-ggplot(data_varpop,aes(x=PC,y=VAR))+
geom_bar(stat='identity',fill="dodgerblue2",alpha=0.25)+
theme_classic()+
xlab("Principal Component")+
ylab("Variation explained (%)")
```
```{r}
subplot(ggplotly(p1)%>% layout(legend = list(orientation = "h", x = 0.2, y =-0.15)), ggplotly(p2)%>%hide_legend(), ggplotly(pp)%>%hide_legend(), titleX=T,titleY=T,margin=0.035,widths=c(0.375,0.425,0.2),which_layout=1) %>% partial_bundle()
```
Hippocampus guttulatus {data-navmenu="Species"}
=======================================================================
```{r, include = FALSE}
load(file = paste(path,"/output/pca/Hgutt_PCA_list.Rdata",sep=""))
```
Row {.tabset data-height=100}
-----------------------
<center>
<font size="6">**Hippocampus guttulatus**</font>
</center>
Row {.tabset data-height=50}
-----------------------
<center>
<font size="6">**All filtered SNPS**</font>
</center>
Row {.tabset data-height=600}
-----------------------
### maf = 0
```{r}
pca=PCA_list$All_filtered$maf0[[1]]
data_pca=data.frame(INDIV=pca$sample.id,
PC1=pca$eigenvect[,1],
PC2=pca$eigenvect[,2],
PC3=pca$eigenvect[,3],
PC4=pca$eigenvect[,4],
LOCA=c(rep("Algarve",5),
rep("Bay of Biscay",11),
rep("Gulf of Lion",5),
rep("Costa Calida",5)))
color_med_atl=rev(brewer.pal(n=4,name="RdBu"))
p<-ggplot(data=data_pca,aes(x=PC1,y=PC2,label=INDIV))+
theme_minimal()+
theme(panel.grid=element_blank(),
panel.border=element_rect(fill="transparent"),
plot.title=element_text(hjust=0.5))+
geom_hline(yintercept=0,lty=2)+
geom_vline(xintercept=0,lty=2)+
geom_point(size=3,aes(col=LOCA))+
xlab(paste("PCA 1 (",round(pca$varprop[1]*100,2),"% )",sep=""))+
ylab(paste("PCA 2 (",round(pca$varprop[2]*100,2),"% )",sep=""))+
scale_colour_manual(name="Location",
values=c(color_med_atl[2],
color_med_atl[1],
color_med_atl[3],
color_med_atl[4]))
p1<-p
p<-ggplot(data=data_pca,aes(x=PC3,y=PC4,label=INDIV))+
theme_minimal()+
theme(panel.grid=element_blank(),
panel.border=element_rect(fill="transparent"),
plot.title=element_text(hjust=0.5))+
geom_hline(yintercept=0,lty=2)+
geom_vline(xintercept=0,lty=2)+
geom_point(size=3,aes(col=LOCA))+
xlab(paste("PCA 3 (",round(pca$varprop[3]*100,2),"% )",sep=""))+
ylab(paste("PCA 4 (",round(pca$varprop[4]*100,2),"% )",sep=""))+
scale_colour_manual(name="Location",
values=c(color_med_atl[2],
color_med_atl[1],
color_med_atl[3],
color_med_atl[4]))
p2<-p
data_varpop=data.frame(PC=factor(paste("P",seq(1,10),sep=""),levels=paste("P",seq(1,10),sep="")),VAR=pca$varprop[1:10])
pp<-ggplot(data_varpop,aes(x=PC,y=VAR))+
geom_bar(stat='identity',fill="dodgerblue2",alpha=0.25)+
theme_classic()+
xlab("Principal Component")+
ylab("Variation explained (%)")
```
```{r}
subplot(ggplotly(p1)%>% layout(legend = list(orientation = "h", x = 0.2, y =-0.15)), ggplotly(p2)%>%hide_legend(), ggplotly(pp)%>%hide_legend(), titleX=T,titleY=T,margin=0.035,widths=c(0.375,0.425,0.2),which_layout=1) %>% partial_bundle()
```
### maf = 0.05
```{r}
pca=PCA_list$All_filtered$maf0.05[[1]]
data_pca=data.frame(INDIV=pca$sample.id,
PC1=pca$eigenvect[,1],
PC2=pca$eigenvect[,2],
PC3=pca$eigenvect[,3],
PC4=pca$eigenvect[,4],
LOCA=c(rep("Algarve",5),
rep("Bay of Biscay",11),
rep("Gulf of Lion",5),
rep("Costa Calida",5)))
color_med_atl=rev(brewer.pal(n=4,name="RdBu"))
p<-ggplot(data=data_pca,aes(x=PC1,y=PC2,label=INDIV))+
theme_minimal()+
theme(panel.grid=element_blank(),
panel.border=element_rect(fill="transparent"),
plot.title=element_text(hjust=0.5))+
geom_hline(yintercept=0,lty=2)+
geom_vline(xintercept=0,lty=2)+
geom_point(size=3,aes(col=LOCA))+
xlab(paste("PCA 1 (",round(pca$varprop[1]*100,2),"% )",sep=""))+
ylab(paste("PCA 2 (",round(pca$varprop[2]*100,2),"% )",sep=""))+
scale_colour_manual(name="Location",
values=c(color_med_atl[2],
color_med_atl[1],
color_med_atl[3],
color_med_atl[4]))
p1<-p
p<-ggplot(data=data_pca,aes(x=PC3,y=PC4,label=INDIV))+
theme_minimal()+
theme(panel.grid=element_blank(),
panel.border=element_rect(fill="transparent"),
plot.title=element_text(hjust=0.5))+
geom_hline(yintercept=0,lty=2)+
geom_vline(xintercept=0,lty=2)+
geom_point(size=3,aes(col=LOCA))+
xlab(paste("PCA 3 (",round(pca$varprop[3]*100,2),"% )",sep=""))+
ylab(paste("PCA 4 (",round(pca$varprop[4]*100,2),"% )",sep=""))+
scale_colour_manual(name="Location",
values=c(color_med_atl[2],
color_med_atl[1],
color_med_atl[3],
color_med_atl[4]))
p2<-p
data_varpop=data.frame(PC=factor(paste("P",seq(1,10),sep=""),levels=paste("P",seq(1,10),sep="")),VAR=pca$varprop[1:10])
pp<-ggplot(data_varpop,aes(x=PC,y=VAR))+
geom_bar(stat='identity',fill="dodgerblue2",alpha=0.25)+
theme_classic()+
xlab("Principal Component")+
ylab("Variation explained (%)")
```
```{r}
subplot(ggplotly(p1)%>% layout(legend = list(orientation = "h", x = 0.2, y =-0.15)), ggplotly(p2)%>%hide_legend(), ggplotly(pp)%>%hide_legend(), titleX=T,titleY=T,margin=0.035,widths=c(0.375,0.425,0.2),which_layout=1) %>% partial_bundle()
```
### maf = 0.1
```{r}
pca=PCA_list$All_filtered$maf0.1[[1]]
data_pca=data.frame(INDIV=pca$sample.id,
PC1=pca$eigenvect[,1],
PC2=pca$eigenvect[,2],
PC3=pca$eigenvect[,3],
PC4=pca$eigenvect[,4],
LOCA=c(rep("Algarve",5),
rep("Bay of Biscay",11),
rep("Gulf of Lion",5),
rep("Costa Calida",5)))
color_med_atl=rev(brewer.pal(n=4,name="RdBu"))
p<-ggplot(data=data_pca,aes(x=PC1,y=PC2,label=INDIV))+
theme_minimal()+
theme(panel.grid=element_blank(),
panel.border=element_rect(fill="transparent"),
plot.title=element_text(hjust=0.5))+
geom_hline(yintercept=0,lty=2)+
geom_vline(xintercept=0,lty=2)+
geom_point(size=3,aes(col=LOCA))+
xlab(paste("PCA 1 (",round(pca$varprop[1]*100,2),"% )",sep=""))+
ylab(paste("PCA 2 (",round(pca$varprop[2]*100,2),"% )",sep=""))+
scale_colour_manual(name="Location",
values=c(color_med_atl[2],
color_med_atl[1],
color_med_atl[3],
color_med_atl[4]))
p1<-p
p<-ggplot(data=data_pca,aes(x=PC3,y=PC4,label=INDIV))+
theme_minimal()+
theme(panel.grid=element_blank(),
panel.border=element_rect(fill="transparent"),
plot.title=element_text(hjust=0.5))+
geom_hline(yintercept=0,lty=2)+
geom_vline(xintercept=0,lty=2)+
geom_point(size=3,aes(col=LOCA))+
xlab(paste("PCA 3 (",round(pca$varprop[3]*100,2),"% )",sep=""))+
ylab(paste("PCA 4 (",round(pca$varprop[4]*100,2),"% )",sep=""))+
scale_colour_manual(name="Location",
values=c(color_med_atl[2],
color_med_atl[1],
color_med_atl[3],
color_med_atl[4]))
p2<-p
data_varpop=data.frame(PC=factor(paste("P",seq(1,10),sep=""),levels=paste("P",seq(1,10),sep="")),VAR=pca$varprop[1:10])
pp<-ggplot(data_varpop,aes(x=PC,y=VAR))+
geom_bar(stat='identity',fill="dodgerblue2",alpha=0.25)+
theme_classic()+
xlab("Principal Component")+
ylab("Variation explained (%)")
```
```{r}
subplot(ggplotly(p1)%>% layout(legend = list(orientation = "h", x = 0.2, y =-0.15)), ggplotly(p2)%>%hide_legend(), ggplotly(pp)%>%hide_legend(), titleX=T,titleY=T,margin=0.035,widths=c(0.375,0.425,0.2),which_layout=1) %>% partial_bundle()
```
### maf = 0.15
```{r}
pca=PCA_list$All_filtered$maf0.15[[1]]
data_pca=data.frame(INDIV=pca$sample.id,
PC1=pca$eigenvect[,1],
PC2=pca$eigenvect[,2],
PC3=pca$eigenvect[,3],
PC4=pca$eigenvect[,4],
LOCA=c(rep("Algarve",5),
rep("Bay of Biscay",11),
rep("Gulf of Lion",5),
rep("Costa Calida",5)))
color_med_atl=rev(brewer.pal(n=4,name="RdBu"))
p<-ggplot(data=data_pca,aes(x=PC1,y=PC2,label=INDIV))+
theme_minimal()+
theme(panel.grid=element_blank(),
panel.border=element_rect(fill="transparent"),
plot.title=element_text(hjust=0.5))+
geom_hline(yintercept=0,lty=2)+
geom_vline(xintercept=0,lty=2)+
geom_point(size=3,aes(col=LOCA))+
xlab(paste("PCA 1 (",round(pca$varprop[1]*100,2),"% )",sep=""))+
ylab(paste("PCA 2 (",round(pca$varprop[2]*100,2),"% )",sep=""))+
scale_colour_manual(name="Location",
values=c(color_med_atl[2],
color_med_atl[1],
color_med_atl[3],
color_med_atl[4]))
p1<-p
p<-ggplot(data=data_pca,aes(x=PC3,y=PC4,label=INDIV))+
theme_minimal()+
theme(panel.grid=element_blank(),
panel.border=element_rect(fill="transparent"),
plot.title=element_text(hjust=0.5))+
geom_hline(yintercept=0,lty=2)+
geom_vline(xintercept=0,lty=2)+
geom_point(size=3,aes(col=LOCA))+
xlab(paste("PCA 3 (",round(pca$varprop[3]*100,2),"% )",sep=""))+
ylab(paste("PCA 4 (",round(pca$varprop[4]*100,2),"% )",sep=""))+
scale_colour_manual(name="Location",
values=c(color_med_atl[2],
color_med_atl[1],
color_med_atl[3],
color_med_atl[4]))
p2<-p
data_varpop=data.frame(PC=factor(paste("P",seq(1,10),sep=""),levels=paste("P",seq(1,10),sep="")),VAR=pca$varprop[1:10])
pp<-ggplot(data_varpop,aes(x=PC,y=VAR))+
geom_bar(stat='identity',fill="dodgerblue2",alpha=0.25)+
theme_classic()+
xlab("Principal Component")+
ylab("Variation explained (%)")
```
```{r}
subplot(ggplotly(p1)%>% layout(legend = list(orientation = "h", x = 0.2, y =-0.15)), ggplotly(p2)%>%hide_legend(), ggplotly(pp)%>%hide_legend(), titleX=T,titleY=T,margin=0.035,widths=c(0.375,0.425,0.2),which_layout=1) %>% partial_bundle()
```
### maf = 0.20
```{r}
pca=PCA_list$All_filtered$maf0.2[[1]]
data_pca=data.frame(INDIV=pca$sample.id,
PC1=pca$eigenvect[,1],
PC2=pca$eigenvect[,2],
PC3=pca$eigenvect[,3],
PC4=pca$eigenvect[,4],
LOCA=c(rep("Algarve",5),
rep("Bay of Biscay",11),
rep("Gulf of Lion",5),
rep("Costa Calida",5)))
color_med_atl=rev(brewer.pal(n=4,name="RdBu"))
p<-ggplot(data=data_pca,aes(x=PC1,y=PC2,label=INDIV))+
theme_minimal()+
theme(panel.grid=element_blank(),
panel.border=element_rect(fill="transparent"),
plot.title=element_text(hjust=0.5))+
geom_hline(yintercept=0,lty=2)+
geom_vline(xintercept=0,lty=2)+
geom_point(size=3,aes(col=LOCA))+
xlab(paste("PCA 1 (",round(pca$varprop[1]*100,2),"% )",sep=""))+
ylab(paste("PCA 2 (",round(pca$varprop[2]*100,2),"% )",sep=""))+
scale_colour_manual(name="Location",
values=c(color_med_atl[2],
color_med_atl[1],
color_med_atl[3],
color_med_atl[4]))
p1<-p
p<-ggplot(data=data_pca,aes(x=PC3,y=PC4,label=INDIV))+
theme_minimal()+
theme(panel.grid=element_blank(),
panel.border=element_rect(fill="transparent"),
plot.title=element_text(hjust=0.5))+
geom_hline(yintercept=0,lty=2)+
geom_vline(xintercept=0,lty=2)+
geom_point(size=3,aes(col=LOCA))+
xlab(paste("PCA 3 (",round(pca$varprop[3]*100,2),"% )",sep=""))+
ylab(paste("PCA 4 (",round(pca$varprop[4]*100,2),"% )",sep=""))+
scale_colour_manual(name="Location",
values=c(color_med_atl[2],
color_med_atl[1],
color_med_atl[3],
color_med_atl[4]))
p2<-p
data_varpop=data.frame(PC=factor(paste("P",seq(1,10),sep=""),levels=paste("P",seq(1,10),sep="")),VAR=pca$varprop[1:10])
pp<-ggplot(data_varpop,aes(x=PC,y=VAR))+
geom_bar(stat='identity',fill="dodgerblue2",alpha=0.25)+
theme_classic()+
xlab("Principal Component")+
ylab("Variation explained (%)")
```
```{r}
subplot(ggplotly(p1)%>% layout(legend = list(orientation = "h", x = 0.2, y =-0.15)), ggplotly(p2)%>%hide_legend(), ggplotly(pp)%>%hide_legend(), titleX=T,titleY=T,margin=0.035,widths=c(0.375,0.425,0.2),which_layout=1) %>% partial_bundle()
```
### maf = 0.25
```{r}
pca=PCA_list$All_filtered$maf0.25[[1]]
data_pca=data.frame(INDIV=pca$sample.id,
PC1=pca$eigenvect[,1],
PC2=pca$eigenvect[,2],
PC3=pca$eigenvect[,3],
PC4=pca$eigenvect[,4],
LOCA=c(rep("Algarve",5),
rep("Bay of Biscay",11),
rep("Gulf of Lion",5),
rep("Costa Calida",5)))
color_med_atl=rev(brewer.pal(n=4,name="RdBu"))
p<-ggplot(data=data_pca,aes(x=PC1,y=PC2,label=INDIV))+
theme_minimal()+
theme(panel.grid=element_blank(),
panel.border=element_rect(fill="transparent"),
plot.title=element_text(hjust=0.5))+
geom_hline(yintercept=0,lty=2)+
geom_vline(xintercept=0,lty=2)+
geom_point(size=3,aes(col=LOCA))+
xlab(paste("PCA 1 (",round(pca$varprop[1]*100,2),"% )",sep=""))+
ylab(paste("PCA 2 (",round(pca$varprop[2]*100,2),"% )",sep=""))+
scale_colour_manual(name="Location",
values=c(color_med_atl[2],
color_med_atl[1],
color_med_atl[3],
color_med_atl[4]))
p1<-p
p<-ggplot(data=data_pca,aes(x=PC3,y=PC4,label=INDIV))+
theme_minimal()+
theme(panel.grid=element_blank(),
panel.border=element_rect(fill="transparent"),
plot.title=element_text(hjust=0.5))+
geom_hline(yintercept=0,lty=2)+
geom_vline(xintercept=0,lty=2)+
geom_point(size=3,aes(col=LOCA))+
xlab(paste("PCA 3 (",round(pca$varprop[3]*100,2),"% )",sep=""))+
ylab(paste("PCA 4 (",round(pca$varprop[4]*100,2),"% )",sep=""))+
scale_colour_manual(name="Location",
values=c(color_med_atl[2],
color_med_atl[1],
color_med_atl[3],
color_med_atl[4]))
p2<-p
data_varpop=data.frame(PC=factor(paste("P",seq(1,10),sep=""),levels=paste("P",seq(1,10),sep="")),VAR=pca$varprop[1:10])
pp<-ggplot(data_varpop,aes(x=PC,y=VAR))+
geom_bar(stat='identity',fill="dodgerblue2",alpha=0.25)+
theme_classic()+
xlab("Principal Component")+
ylab("Variation explained (%)")
```
```{r}
subplot(ggplotly(p1)%>% layout(legend = list(orientation = "h", x = 0.2, y =-0.15)), ggplotly(p2)%>%hide_legend(), ggplotly(pp)%>%hide_legend(), titleX=T,titleY=T,margin=0.035,widths=c(0.375,0.425,0.2),which_layout=1) %>% partial_bundle()
```
### maf = 0.30
```{r}
pca=PCA_list$All_filtered$maf0.3[[1]]
data_pca=data.frame(INDIV=pca$sample.id,
PC1=pca$eigenvect[,1],
PC2=pca$eigenvect[,2],
PC3=pca$eigenvect[,3],
PC4=pca$eigenvect[,4],
LOCA=c(rep("Algarve",5),
rep("Bay of Biscay",11),
rep("Gulf of Lion",5),
rep("Costa Calida",5)))
color_med_atl=rev(brewer.pal(n=4,name="RdBu"))
p<-ggplot(data=data_pca,aes(x=PC1,y=PC2,label=INDIV))+
theme_minimal()+
theme(panel.grid=element_blank(),
panel.border=element_rect(fill="transparent"),
plot.title=element_text(hjust=0.5))+
geom_hline(yintercept=0,lty=2)+
geom_vline(xintercept=0,lty=2)+
geom_point(size=3,aes(col=LOCA))+
xlab(paste("PCA 1 (",round(pca$varprop[1]*100,2),"% )",sep=""))+
ylab(paste("PCA 2 (",round(pca$varprop[2]*100,2),"% )",sep=""))+
scale_colour_manual(name="Location",
values=c(color_med_atl[2],
color_med_atl[1],
color_med_atl[3],
color_med_atl[4]))
p1<-p
p<-ggplot(data=data_pca,aes(x=PC3,y=PC4,label=INDIV))+
theme_minimal()+
theme(panel.grid=element_blank(),
panel.border=element_rect(fill="transparent"),
plot.title=element_text(hjust=0.5))+
geom_hline(yintercept=0,lty=2)+
geom_vline(xintercept=0,lty=2)+
geom_point(size=3,aes(col=LOCA))+
xlab(paste("PCA 3 (",round(pca$varprop[3]*100,2),"% )",sep=""))+
ylab(paste("PCA 4 (",round(pca$varprop[4]*100,2),"% )",sep=""))+
scale_colour_manual(name="Location",
values=c(color_med_atl[2],
color_med_atl[1],
color_med_atl[3],
color_med_atl[4]))
p2<-p
data_varpop=data.frame(PC=factor(paste("P",seq(1,10),sep=""),levels=paste("P",seq(1,10),sep="")),VAR=pca$varprop[1:10])
pp<-ggplot(data_varpop,aes(x=PC,y=VAR))+
geom_bar(stat='identity',fill="dodgerblue2",alpha=0.25)+
theme_classic()+
xlab("Principal Component")+
ylab("Variation explained (%)")
```
```{r}
subplot(ggplotly(p1)%>% layout(legend = list(orientation = "h", x = 0.2, y =-0.15)), ggplotly(p2)%>%hide_legend(), ggplotly(pp)%>%hide_legend(), titleX=T,titleY=T,margin=0.035,widths=c(0.375,0.425,0.2),which_layout=1) %>% partial_bundle()
```
### maf = 0.35
```{r}
pca=PCA_list$All_filtered$maf0.35[[1]]
data_pca=data.frame(INDIV=pca$sample.id,
PC1=pca$eigenvect[,1],
PC2=pca$eigenvect[,2],
PC3=pca$eigenvect[,3],
PC4=pca$eigenvect[,4],
LOCA=c(rep("Algarve",5),
rep("Bay of Biscay",11),
rep("Gulf of Lion",5),
rep("Costa Calida",5)))
color_med_atl=rev(brewer.pal(n=4,name="RdBu"))
p<-ggplot(data=data_pca,aes(x=PC1,y=PC2,label=INDIV))+
theme_minimal()+
theme(panel.grid=element_blank(),
panel.border=element_rect(fill="transparent"),
plot.title=element_text(hjust=0.5))+
geom_hline(yintercept=0,lty=2)+
geom_vline(xintercept=0,lty=2)+
geom_point(size=3,aes(col=LOCA))+
xlab(paste("PCA 1 (",round(pca$varprop[1]*100,2),"% )",sep=""))+
ylab(paste("PCA 2 (",round(pca$varprop[2]*100,2),"% )",sep=""))+
scale_colour_manual(name="Location",
values=c(color_med_atl[2],
color_med_atl[1],
color_med_atl[3],
color_med_atl[4]))
p1<-p
p<-ggplot(data=data_pca,aes(x=PC3,y=PC4,label=INDIV))+
theme_minimal()+
theme(panel.grid=element_blank(),
panel.border=element_rect(fill="transparent"),
plot.title=element_text(hjust=0.5))+
geom_hline(yintercept=0,lty=2)+
geom_vline(xintercept=0,lty=2)+
geom_point(size=3,aes(col=LOCA))+
xlab(paste("PCA 3 (",round(pca$varprop[3]*100,2),"% )",sep=""))+
ylab(paste("PCA 4 (",round(pca$varprop[4]*100,2),"% )",sep=""))+
scale_colour_manual(name="Location",
values=c(color_med_atl[2],
color_med_atl[1],
color_med_atl[3],
color_med_atl[4]))
p2<-p
data_varpop=data.frame(PC=factor(paste("P",seq(1,10),sep=""),levels=paste("P",seq(1,10),sep="")),VAR=pca$varprop[1:10])
pp<-ggplot(data_varpop,aes(x=PC,y=VAR))+
geom_bar(stat='identity',fill="dodgerblue2",alpha=0.25)+
theme_classic()+
xlab("Principal Component")+
ylab("Variation explained (%)")
```
```{r}
subplot(ggplotly(p1)%>% layout(legend = list(orientation = "h", x = 0.2, y =-0.15)), ggplotly(p2)%>%hide_legend(), ggplotly(pp)%>%hide_legend(), titleX=T,titleY=T,margin=0.035,widths=c(0.375,0.425,0.2),which_layout=1) %>% partial_bundle()
```
### maf = 0.40
```{r}
pca=PCA_list$All_filtered$maf0.4[[1]]
data_pca=data.frame(INDIV=pca$sample.id,
PC1=pca$eigenvect[,1],
PC2=pca$eigenvect[,2],
PC3=pca$eigenvect[,3],
PC4=pca$eigenvect[,4],
LOCA=c(rep("Algarve",5),
rep("Bay of Biscay",11),
rep("Gulf of Lion",5),
rep("Costa Calida",5)))
color_med_atl=rev(brewer.pal(n=4,name="RdBu"))
p<-ggplot(data=data_pca,aes(x=PC1,y=PC2,label=INDIV))+
theme_minimal()+
theme(panel.grid=element_blank(),
panel.border=element_rect(fill="transparent"),
plot.title=element_text(hjust=0.5))+
geom_hline(yintercept=0,lty=2)+
geom_vline(xintercept=0,lty=2)+
geom_point(size=3,aes(col=LOCA))+
xlab(paste("PCA 1 (",round(pca$varprop[1]*100,2),"% )",sep=""))+
ylab(paste("PCA 2 (",round(pca$varprop[2]*100,2),"% )",sep=""))+
scale_colour_manual(name="Location",
values=c(color_med_atl[2],
color_med_atl[1],
color_med_atl[3],
color_med_atl[4]))
p1<-p
p<-ggplot(data=data_pca,aes(x=PC3,y=PC4,label=INDIV))+
theme_minimal()+
theme(panel.grid=element_blank(),
panel.border=element_rect(fill="transparent"),
plot.title=element_text(hjust=0.5))+
geom_hline(yintercept=0,lty=2)+
geom_vline(xintercept=0,lty=2)+
geom_point(size=3,aes(col=LOCA))+
xlab(paste("PCA 3 (",round(pca$varprop[3]*100,2),"% )",sep=""))+
ylab(paste("PCA 4 (",round(pca$varprop[4]*100,2),"% )",sep=""))+
scale_colour_manual(name="Location",
values=c(color_med_atl[2],
color_med_atl[1],
color_med_atl[3],
color_med_atl[4]))
p2<-p
data_varpop=data.frame(PC=factor(paste("P",seq(1,10),sep=""),levels=paste("P",seq(1,10),sep="")),VAR=pca$varprop[1:10])
pp<-ggplot(data_varpop,aes(x=PC,y=VAR))+
geom_bar(stat='identity',fill="dodgerblue2",alpha=0.25)+
theme_classic()+
xlab("Principal Component")+
ylab("Variation explained (%)")
```
```{r}
subplot(ggplotly(p1)%>% layout(legend = list(orientation = "h", x = 0.2, y =-0.15)), ggplotly(p2)%>%hide_legend(), ggplotly(pp)%>%hide_legend(), titleX=T,titleY=T,margin=0.035,widths=c(0.375,0.425,0.2),which_layout=1) %>% partial_bundle()
```
### maf = 0.45
```{r}
pca=PCA_list$All_filtered$maf0.45[[1]]
data_pca=data.frame(INDIV=pca$sample.id,
PC1=pca$eigenvect[,1],
PC2=pca$eigenvect[,2],
PC3=pca$eigenvect[,3],
PC4=pca$eigenvect[,4],
LOCA=c(rep("Algarve",5),
rep("Bay of Biscay",11),
rep("Gulf of Lion",5),
rep("Costa Calida",5)))
color_med_atl=rev(brewer.pal(n=4,name="RdBu"))
p<-ggplot(data=data_pca,aes(x=PC1,y=PC2,label=INDIV))+
theme_minimal()+
theme(panel.grid=element_blank(),
panel.border=element_rect(fill="transparent"),
plot.title=element_text(hjust=0.5))+
geom_hline(yintercept=0,lty=2)+
geom_vline(xintercept=0,lty=2)+
geom_point(size=3,aes(col=LOCA))+
xlab(paste("PCA 1 (",round(pca$varprop[1]*100,2),"% )",sep=""))+
ylab(paste("PCA 2 (",round(pca$varprop[2]*100,2),"% )",sep=""))+
scale_colour_manual(name="Location",
values=c(color_med_atl[2],
color_med_atl[1],
color_med_atl[3],
color_med_atl[4]))
p1<-p
p<-ggplot(data=data_pca,aes(x=PC3,y=PC4,label=INDIV))+
theme_minimal()+
theme(panel.grid=element_blank(),
panel.border=element_rect(fill="transparent"),
plot.title=element_text(hjust=0.5))+
geom_hline(yintercept=0,lty=2)+
geom_vline(xintercept=0,lty=2)+
geom_point(size=3,aes(col=LOCA))+
xlab(paste("PCA 3 (",round(pca$varprop[3]*100,2),"% )",sep=""))+
ylab(paste("PCA 4 (",round(pca$varprop[4]*100,2),"% )",sep=""))+
scale_colour_manual(name="Location",
values=c(color_med_atl[2],
color_med_atl[1],
color_med_atl[3],
color_med_atl[4]))
p2<-p
data_varpop=data.frame(PC=factor(paste("P",seq(1,10),sep=""),levels=paste("P",seq(1,10),sep="")),VAR=pca$varprop[1:10])
pp<-ggplot(data_varpop,aes(x=PC,y=VAR))+
geom_bar(stat='identity',fill="dodgerblue2",alpha=0.25)+
theme_classic()+
xlab("Principal Component")+
ylab("Variation explained (%)")
```
```{r}
subplot(ggplotly(p1)%>% layout(legend = list(orientation = "h", x = 0.2, y =-0.15)), ggplotly(p2)%>%hide_legend(), ggplotly(pp)%>%hide_legend(), titleX=T,titleY=T,margin=0.035,widths=c(0.375,0.425,0.2),which_layout=1) %>% partial_bundle()
```
### maf = 0.50
```{r}
pca=PCA_list$All_filtered$maf0.5[[1]]
data_pca=data.frame(INDIV=pca$sample.id,
PC1=pca$eigenvect[,1],
PC2=pca$eigenvect[,2],
PC3=pca$eigenvect[,3],
PC4=pca$eigenvect[,4],
LOCA=c(rep("Algarve",5),
rep("Bay of Biscay",11),
rep("Gulf of Lion",5),
rep("Costa Calida",5)))
color_med_atl=rev(brewer.pal(n=4,name="RdBu"))
p<-ggplot(data=data_pca,aes(x=PC1,y=PC2,label=INDIV))+
theme_minimal()+
theme(panel.grid=element_blank(),
panel.border=element_rect(fill="transparent"),
plot.title=element_text(hjust=0.5))+
geom_hline(yintercept=0,lty=2)+
geom_vline(xintercept=0,lty=2)+
geom_point(size=3,aes(col=LOCA))+
xlab(paste("PCA 1 (",round(pca$varprop[1]*100,2),"% )",sep=""))+
ylab(paste("PCA 2 (",round(pca$varprop[2]*100,2),"% )",sep=""))+
scale_colour_manual(name="Location",
values=c(color_med_atl[2],
color_med_atl[1],
color_med_atl[3],
color_med_atl[4]))
p1<-p
p<-ggplot(data=data_pca,aes(x=PC3,y=PC4,label=INDIV))+
theme_minimal()+
theme(panel.grid=element_blank(),
panel.border=element_rect(fill="transparent"),
plot.title=element_text(hjust=0.5))+
geom_hline(yintercept=0,lty=2)+
geom_vline(xintercept=0,lty=2)+
geom_point(size=3,aes(col=LOCA))+
xlab(paste("PCA 3 (",round(pca$varprop[3]*100,2),"% )",sep=""))+
ylab(paste("PCA 4 (",round(pca$varprop[4]*100,2),"% )",sep=""))+
scale_colour_manual(name="Location",
values=c(color_med_atl[2],
color_med_atl[1],
color_med_atl[3],
color_med_atl[4]))
p2<-p
data_varpop=data.frame(PC=factor(paste("P",seq(1,10),sep=""),levels=paste("P",seq(1,10),sep="")),VAR=pca$varprop[1:10])
pp<-ggplot(data_varpop,aes(x=PC,y=VAR))+
geom_bar(stat='identity',fill="dodgerblue2",alpha=0.25)+
theme_classic()+
xlab("Principal Component")+
ylab("Variation explained (%)")
```
```{r}
subplot(ggplotly(p1)%>% layout(legend = list(orientation = "h", x = 0.2, y =-0.15)), ggplotly(p2)%>%hide_legend(), ggplotly(pp)%>%hide_legend(), titleX=T,titleY=T,margin=0.035,widths=c(0.375,0.425,0.2),which_layout=1) %>% partial_bundle()
```
Row {.tabset data-height=50}
-----------------------
<center>
<font size="6">**Pruned filtered SNPS**</font>
</center>
Row {.tabset data-height=600}
-----------------------
### maf = 0
```{r}
pca=PCA_list$Prune_filtered$maf0[[1]]
data_pca=data.frame(INDIV=pca$sample.id,
PC1=pca$eigenvect[,1],
PC2=pca$eigenvect[,2],
PC3=pca$eigenvect[,3],
PC4=pca$eigenvect[,4],
LOCA=c(rep("Algarve",5),
rep("Bay of Biscay",11),
rep("Gulf of Lion",5),
rep("Costa Calida",5)))
color_med_atl=rev(brewer.pal(n=4,name="RdBu"))
p<-ggplot(data=data_pca,aes(x=PC1,y=PC2,label=INDIV))+
theme_minimal()+
theme(panel.grid=element_blank(),
panel.border=element_rect(fill="transparent"),
plot.title=element_text(hjust=0.5))+
geom_hline(yintercept=0,lty=2)+
geom_vline(xintercept=0,lty=2)+
geom_point(size=3,aes(col=LOCA))+
xlab(paste("PCA 1 (",round(pca$varprop[1]*100,2),"% )",sep=""))+
ylab(paste("PCA 2 (",round(pca$varprop[2]*100,2),"% )",sep=""))+
scale_colour_manual(name="Location",
values=c(color_med_atl[2],
color_med_atl[1],
color_med_atl[3],
color_med_atl[4]))
p1<-p
p<-ggplot(data=data_pca,aes(x=PC3,y=PC4,label=INDIV))+
theme_minimal()+
theme(panel.grid=element_blank(),
panel.border=element_rect(fill="transparent"),
plot.title=element_text(hjust=0.5))+
geom_hline(yintercept=0,lty=2)+
geom_vline(xintercept=0,lty=2)+
geom_point(size=3,aes(col=LOCA))+
xlab(paste("PCA 3 (",round(pca$varprop[3]*100,2),"% )",sep=""))+
ylab(paste("PCA 4 (",round(pca$varprop[4]*100,2),"% )",sep=""))+
scale_colour_manual(name="Location",
values=c(color_med_atl[2],
color_med_atl[1],
color_med_atl[3],
color_med_atl[4]))
p2<-p
data_varpop=data.frame(PC=factor(paste("P",seq(1,10),sep=""),levels=paste("P",seq(1,10),sep="")),VAR=pca$varprop[1:10])
pp<-ggplot(data_varpop,aes(x=PC,y=VAR))+
geom_bar(stat='identity',fill="dodgerblue2",alpha=0.25)+
theme_classic()+
xlab("Principal Component")+
ylab("Variation explained (%)")
```
```{r}
subplot(ggplotly(p1)%>% layout(legend = list(orientation = "h", x = 0.2, y =-0.15)), ggplotly(p2)%>%hide_legend(), ggplotly(pp)%>%hide_legend(), titleX=T,titleY=T,margin=0.035,widths=c(0.375,0.425,0.2),which_layout=1) %>% partial_bundle()
```
### maf = 0.05
```{r}
pca=PCA_list$Prune_filtered$maf0.05[[1]]
data_pca=data.frame(INDIV=pca$sample.id,
PC1=pca$eigenvect[,1],
PC2=pca$eigenvect[,2],
PC3=pca$eigenvect[,3],
PC4=pca$eigenvect[,4],
LOCA=c(rep("Algarve",5),
rep("Bay of Biscay",11),
rep("Gulf of Lion",5),
rep("Costa Calida",5)))
color_med_atl=rev(brewer.pal(n=4,name="RdBu"))
p<-ggplot(data=data_pca,aes(x=PC1,y=PC2,label=INDIV))+
theme_minimal()+
theme(panel.grid=element_blank(),
panel.border=element_rect(fill="transparent"),
plot.title=element_text(hjust=0.5))+
geom_hline(yintercept=0,lty=2)+
geom_vline(xintercept=0,lty=2)+
geom_point(size=3,aes(col=LOCA))+
xlab(paste("PCA 1 (",round(pca$varprop[1]*100,2),"% )",sep=""))+
ylab(paste("PCA 2 (",round(pca$varprop[2]*100,2),"% )",sep=""))+
scale_colour_manual(name="Location",
values=c(color_med_atl[2],
color_med_atl[1],
color_med_atl[3],
color_med_atl[4]))
p1<-p
p<-ggplot(data=data_pca,aes(x=PC3,y=PC4,label=INDIV))+
theme_minimal()+
theme(panel.grid=element_blank(),
panel.border=element_rect(fill="transparent"),
plot.title=element_text(hjust=0.5))+
geom_hline(yintercept=0,lty=2)+
geom_vline(xintercept=0,lty=2)+
geom_point(size=3,aes(col=LOCA))+
xlab(paste("PCA 3 (",round(pca$varprop[3]*100,2),"% )",sep=""))+
ylab(paste("PCA 4 (",round(pca$varprop[4]*100,2),"% )",sep=""))+
scale_colour_manual(name="Location",
values=c(color_med_atl[2],
color_med_atl[1],
color_med_atl[3],
color_med_atl[4]))
p2<-p
data_varpop=data.frame(PC=factor(paste("P",seq(1,10),sep=""),levels=paste("P",seq(1,10),sep="")),VAR=pca$varprop[1:10])
pp<-ggplot(data_varpop,aes(x=PC,y=VAR))+
geom_bar(stat='identity',fill="dodgerblue2",alpha=0.25)+
theme_classic()+
xlab("Principal Component")+
ylab("Variation explained (%)")
```
```{r}
subplot(ggplotly(p1)%>% layout(legend = list(orientation = "h", x = 0.2, y =-0.15)), ggplotly(p2)%>%hide_legend(), ggplotly(pp)%>%hide_legend(), titleX=T,titleY=T,margin=0.035,widths=c(0.375,0.425,0.2),which_layout=1) %>% partial_bundle()
```
### maf = 0.1
```{r}
pca=PCA_list$Prune_filtered$maf0.1[[1]]
data_pca=data.frame(INDIV=pca$sample.id,
PC1=pca$eigenvect[,1],
PC2=pca$eigenvect[,2],
PC3=pca$eigenvect[,3],
PC4=pca$eigenvect[,4],
LOCA=c(rep("Algarve",5),
rep("Bay of Biscay",11),
rep("Gulf of Lion",5),
rep("Costa Calida",5)))
color_med_atl=rev(brewer.pal(n=4,name="RdBu"))
p<-ggplot(data=data_pca,aes(x=PC1,y=PC2,label=INDIV))+
theme_minimal()+
theme(panel.grid=element_blank(),
panel.border=element_rect(fill="transparent"),
plot.title=element_text(hjust=0.5))+
geom_hline(yintercept=0,lty=2)+
geom_vline(xintercept=0,lty=2)+
geom_point(size=3,aes(col=LOCA))+
xlab(paste("PCA 1 (",round(pca$varprop[1]*100,2),"% )",sep=""))+
ylab(paste("PCA 2 (",round(pca$varprop[2]*100,2),"% )",sep=""))+
scale_colour_manual(name="Location",
values=c(color_med_atl[2],
color_med_atl[1],
color_med_atl[3],
color_med_atl[4]))
p1<-p
p<-ggplot(data=data_pca,aes(x=PC3,y=PC4,label=INDIV))+
theme_minimal()+
theme(panel.grid=element_blank(),
panel.border=element_rect(fill="transparent"),
plot.title=element_text(hjust=0.5))+
geom_hline(yintercept=0,lty=2)+
geom_vline(xintercept=0,lty=2)+
geom_point(size=3,aes(col=LOCA))+
xlab(paste("PCA 3 (",round(pca$varprop[3]*100,2),"% )",sep=""))+
ylab(paste("PCA 4 (",round(pca$varprop[4]*100,2),"% )",sep=""))+
scale_colour_manual(name="Location",
values=c(color_med_atl[2],
color_med_atl[1],
color_med_atl[3],
color_med_atl[4]))
p2<-p
data_varpop=data.frame(PC=factor(paste("P",seq(1,10),sep=""),levels=paste("P",seq(1,10),sep="")),VAR=pca$varprop[1:10])
pp<-ggplot(data_varpop,aes(x=PC,y=VAR))+
geom_bar(stat='identity',fill="dodgerblue2",alpha=0.25)+
theme_classic()+
xlab("Principal Component")+
ylab("Variation explained (%)")
```
```{r}
subplot(ggplotly(p1)%>% layout(legend = list(orientation = "h", x = 0.2, y =-0.15)), ggplotly(p2)%>%hide_legend(), ggplotly(pp)%>%hide_legend(), titleX=T,titleY=T,margin=0.035,widths=c(0.375,0.425,0.2),which_layout=1) %>% partial_bundle()
```
### maf = 0.15
```{r}
pca=PCA_list$Prune_filtered$maf0.15[[1]]
data_pca=data.frame(INDIV=pca$sample.id,
PC1=pca$eigenvect[,1],
PC2=pca$eigenvect[,2],
PC3=pca$eigenvect[,3],
PC4=pca$eigenvect[,4],
LOCA=c(rep("Algarve",5),
rep("Bay of Biscay",11),
rep("Gulf of Lion",5),
rep("Costa Calida",5)))
color_med_atl=rev(brewer.pal(n=4,name="RdBu"))
p<-ggplot(data=data_pca,aes(x=PC1,y=PC2,label=INDIV))+
theme_minimal()+
theme(panel.grid=element_blank(),
panel.border=element_rect(fill="transparent"),
plot.title=element_text(hjust=0.5))+
geom_hline(yintercept=0,lty=2)+
geom_vline(xintercept=0,lty=2)+
geom_point(size=3,aes(col=LOCA))+
xlab(paste("PCA 1 (",round(pca$varprop[1]*100,2),"% )",sep=""))+
ylab(paste("PCA 2 (",round(pca$varprop[2]*100,2),"% )",sep=""))+
scale_colour_manual(name="Location",
values=c(color_med_atl[2],
color_med_atl[1],
color_med_atl[3],
color_med_atl[4]))
p1<-p
p<-ggplot(data=data_pca,aes(x=PC3,y=PC4,label=INDIV))+
theme_minimal()+
theme(panel.grid=element_blank(),
panel.border=element_rect(fill="transparent"),
plot.title=element_text(hjust=0.5))+
geom_hline(yintercept=0,lty=2)+
geom_vline(xintercept=0,lty=2)+
geom_point(size=3,aes(col=LOCA))+
xlab(paste("PCA 3 (",round(pca$varprop[3]*100,2),"% )",sep=""))+
ylab(paste("PCA 4 (",round(pca$varprop[4]*100,2),"% )",sep=""))+
scale_colour_manual(name="Location",
values=c(color_med_atl[2],
color_med_atl[1],
color_med_atl[3],
color_med_atl[4]))
p2<-p
data_varpop=data.frame(PC=factor(paste("P",seq(1,10),sep=""),levels=paste("P",seq(1,10),sep="")),VAR=pca$varprop[1:10])
pp<-ggplot(data_varpop,aes(x=PC,y=VAR))+
geom_bar(stat='identity',fill="dodgerblue2",alpha=0.25)+
theme_classic()+
xlab("Principal Component")+
ylab("Variation explained (%)")
```
```{r}
subplot(ggplotly(p1)%>% layout(legend = list(orientation = "h", x = 0.2, y =-0.15)), ggplotly(p2)%>%hide_legend(), ggplotly(pp)%>%hide_legend(), titleX=T,titleY=T,margin=0.035,widths=c(0.375,0.425,0.2),which_layout=1) %>% partial_bundle()
```
### maf = 0.20
```{r}
pca=PCA_list$Prune_filtered$maf0.2[[1]]
data_pca=data.frame(INDIV=pca$sample.id,
PC1=pca$eigenvect[,1],
PC2=pca$eigenvect[,2],
PC3=pca$eigenvect[,3],
PC4=pca$eigenvect[,4],
LOCA=c(rep("Algarve",5),
rep("Bay of Biscay",11),
rep("Gulf of Lion",5),
rep("Costa Calida",5)))
color_med_atl=rev(brewer.pal(n=4,name="RdBu"))
p<-ggplot(data=data_pca,aes(x=PC1,y=PC2,label=INDIV))+
theme_minimal()+
theme(panel.grid=element_blank(),
panel.border=element_rect(fill="transparent"),
plot.title=element_text(hjust=0.5))+
geom_hline(yintercept=0,lty=2)+
geom_vline(xintercept=0,lty=2)+
geom_point(size=3,aes(col=LOCA))+
xlab(paste("PCA 1 (",round(pca$varprop[1]*100,2),"% )",sep=""))+
ylab(paste("PCA 2 (",round(pca$varprop[2]*100,2),"% )",sep=""))+
scale_colour_manual(name="Location",
values=c(color_med_atl[2],
color_med_atl[1],
color_med_atl[3],
color_med_atl[4]))
p1<-p
p<-ggplot(data=data_pca,aes(x=PC3,y=PC4,label=INDIV))+
theme_minimal()+
theme(panel.grid=element_blank(),
panel.border=element_rect(fill="transparent"),
plot.title=element_text(hjust=0.5))+
geom_hline(yintercept=0,lty=2)+
geom_vline(xintercept=0,lty=2)+
geom_point(size=3,aes(col=LOCA))+
xlab(paste("PCA 3 (",round(pca$varprop[3]*100,2),"% )",sep=""))+
ylab(paste("PCA 4 (",round(pca$varprop[4]*100,2),"% )",sep=""))+
scale_colour_manual(name="Location",
values=c(color_med_atl[2],
color_med_atl[1],
color_med_atl[3],
color_med_atl[4]))
p2<-p
data_varpop=data.frame(PC=factor(paste("P",seq(1,10),sep=""),levels=paste("P",seq(1,10),sep="")),VAR=pca$varprop[1:10])
pp<-ggplot(data_varpop,aes(x=PC,y=VAR))+
geom_bar(stat='identity',fill="dodgerblue2",alpha=0.25)+
theme_classic()+
xlab("Principal Component")+
ylab("Variation explained (%)")
```
```{r}
subplot(ggplotly(p1)%>% layout(legend = list(orientation = "h", x = 0.2, y =-0.15)), ggplotly(p2)%>%hide_legend(), ggplotly(pp)%>%hide_legend(), titleX=T,titleY=T,margin=0.035,widths=c(0.375,0.425,0.2),which_layout=1) %>% partial_bundle()
```
### maf = 0.25
```{r}
pca=PCA_list$Prune_filtered$maf0.25[[1]]
data_pca=data.frame(INDIV=pca$sample.id,
PC1=pca$eigenvect[,1],
PC2=pca$eigenvect[,2],
PC3=pca$eigenvect[,3],
PC4=pca$eigenvect[,4],
LOCA=c(rep("Algarve",5),
rep("Bay of Biscay",11),
rep("Gulf of Lion",5),
rep("Costa Calida",5)))
color_med_atl=rev(brewer.pal(n=4,name="RdBu"))
p<-ggplot(data=data_pca,aes(x=PC1,y=PC2,label=INDIV))+
theme_minimal()+
theme(panel.grid=element_blank(),
panel.border=element_rect(fill="transparent"),
plot.title=element_text(hjust=0.5))+
geom_hline(yintercept=0,lty=2)+
geom_vline(xintercept=0,lty=2)+
geom_point(size=3,aes(col=LOCA))+
xlab(paste("PCA 1 (",round(pca$varprop[1]*100,2),"% )",sep=""))+
ylab(paste("PCA 2 (",round(pca$varprop[2]*100,2),"% )",sep=""))+
scale_colour_manual(name="Location",
values=c(color_med_atl[2],
color_med_atl[1],
color_med_atl[3],
color_med_atl[4]))
p1<-p
p<-ggplot(data=data_pca,aes(x=PC3,y=PC4,label=INDIV))+
theme_minimal()+
theme(panel.grid=element_blank(),
panel.border=element_rect(fill="transparent"),
plot.title=element_text(hjust=0.5))+
geom_hline(yintercept=0,lty=2)+
geom_vline(xintercept=0,lty=2)+
geom_point(size=3,aes(col=LOCA))+
xlab(paste("PCA 3 (",round(pca$varprop[3]*100,2),"% )",sep=""))+
ylab(paste("PCA 4 (",round(pca$varprop[4]*100,2),"% )",sep=""))+
scale_colour_manual(name="Location",
values=c(color_med_atl[2],
color_med_atl[1],
color_med_atl[3],
color_med_atl[4]))
p2<-p
data_varpop=data.frame(PC=factor(paste("P",seq(1,10),sep=""),levels=paste("P",seq(1,10),sep="")),VAR=pca$varprop[1:10])
pp<-ggplot(data_varpop,aes(x=PC,y=VAR))+
geom_bar(stat='identity',fill="dodgerblue2",alpha=0.25)+
theme_classic()+
xlab("Principal Component")+
ylab("Variation explained (%)")
```
```{r}
subplot(ggplotly(p1)%>% layout(legend = list(orientation = "h", x = 0.2, y =-0.15)), ggplotly(p2)%>%hide_legend(), ggplotly(pp)%>%hide_legend(), titleX=T,titleY=T,margin=0.035,widths=c(0.375,0.425,0.2),which_layout=1) %>% partial_bundle()
```
### maf = 0.30
```{r}
pca=PCA_list$Prune_filtered$maf0.3[[1]]
data_pca=data.frame(INDIV=pca$sample.id,
PC1=pca$eigenvect[,1],
PC2=pca$eigenvect[,2],
PC3=pca$eigenvect[,3],
PC4=pca$eigenvect[,4],
LOCA=c(rep("Algarve",5),
rep("Bay of Biscay",11),
rep("Gulf of Lion",5),
rep("Costa Calida",5)))
color_med_atl=rev(brewer.pal(n=4,name="RdBu"))
p<-ggplot(data=data_pca,aes(x=PC1,y=PC2,label=INDIV))+
theme_minimal()+
theme(panel.grid=element_blank(),
panel.border=element_rect(fill="transparent"),
plot.title=element_text(hjust=0.5))+
geom_hline(yintercept=0,lty=2)+
geom_vline(xintercept=0,lty=2)+
geom_point(size=3,aes(col=LOCA))+
xlab(paste("PCA 1 (",round(pca$varprop[1]*100,2),"% )",sep=""))+
ylab(paste("PCA 2 (",round(pca$varprop[2]*100,2),"% )",sep=""))+
scale_colour_manual(name="Location",
values=c(color_med_atl[2],
color_med_atl[1],
color_med_atl[3],
color_med_atl[4]))
p1<-p
p<-ggplot(data=data_pca,aes(x=PC3,y=PC4,label=INDIV))+
theme_minimal()+
theme(panel.grid=element_blank(),
panel.border=element_rect(fill="transparent"),
plot.title=element_text(hjust=0.5))+
geom_hline(yintercept=0,lty=2)+
geom_vline(xintercept=0,lty=2)+
geom_point(size=3,aes(col=LOCA))+
xlab(paste("PCA 3 (",round(pca$varprop[3]*100,2),"% )",sep=""))+
ylab(paste("PCA 4 (",round(pca$varprop[4]*100,2),"% )",sep=""))+
scale_colour_manual(name="Location",
values=c(color_med_atl[2],
color_med_atl[1],
color_med_atl[3],
color_med_atl[4]))
p2<-p
data_varpop=data.frame(PC=factor(paste("P",seq(1,10),sep=""),levels=paste("P",seq(1,10),sep="")),VAR=pca$varprop[1:10])
pp<-ggplot(data_varpop,aes(x=PC,y=VAR))+
geom_bar(stat='identity',fill="dodgerblue2",alpha=0.25)+
theme_classic()+
xlab("Principal Component")+
ylab("Variation explained (%)")
```
```{r}
subplot(ggplotly(p1)%>% layout(legend = list(orientation = "h", x = 0.2, y =-0.15)), ggplotly(p2)%>%hide_legend(), ggplotly(pp)%>%hide_legend(), titleX=T,titleY=T,margin=0.035,widths=c(0.375,0.425,0.2),which_layout=1) %>% partial_bundle()
```
### maf = 0.35
```{r}
pca=PCA_list$Prune_filtered$maf0.35[[1]]
data_pca=data.frame(INDIV=pca$sample.id,
PC1=pca$eigenvect[,1],
PC2=pca$eigenvect[,2],
PC3=pca$eigenvect[,3],
PC4=pca$eigenvect[,4],
LOCA=c(rep("Algarve",5),
rep("Bay of Biscay",11),
rep("Gulf of Lion",5),
rep("Costa Calida",5)))
color_med_atl=rev(brewer.pal(n=4,name="RdBu"))
p<-ggplot(data=data_pca,aes(x=PC1,y=PC2,label=INDIV))+
theme_minimal()+
theme(panel.grid=element_blank(),
panel.border=element_rect(fill="transparent"),
plot.title=element_text(hjust=0.5))+
geom_hline(yintercept=0,lty=2)+
geom_vline(xintercept=0,lty=2)+
geom_point(size=3,aes(col=LOCA))+
xlab(paste("PCA 1 (",round(pca$varprop[1]*100,2),"% )",sep=""))+
ylab(paste("PCA 2 (",round(pca$varprop[2]*100,2),"% )",sep=""))+
scale_colour_manual(name="Location",
values=c(color_med_atl[2],
color_med_atl[1],
color_med_atl[3],
color_med_atl[4]))
p1<-p
p<-ggplot(data=data_pca,aes(x=PC3,y=PC4,label=INDIV))+
theme_minimal()+
theme(panel.grid=element_blank(),
panel.border=element_rect(fill="transparent"),
plot.title=element_text(hjust=0.5))+
geom_hline(yintercept=0,lty=2)+
geom_vline(xintercept=0,lty=2)+
geom_point(size=3,aes(col=LOCA))+
xlab(paste("PCA 3 (",round(pca$varprop[3]*100,2),"% )",sep=""))+
ylab(paste("PCA 4 (",round(pca$varprop[4]*100,2),"% )",sep=""))+
scale_colour_manual(name="Location",
values=c(color_med_atl[2],
color_med_atl[1],
color_med_atl[3],
color_med_atl[4]))
p2<-p
data_varpop=data.frame(PC=factor(paste("P",seq(1,10),sep=""),levels=paste("P",seq(1,10),sep="")),VAR=pca$varprop[1:10])
pp<-ggplot(data_varpop,aes(x=PC,y=VAR))+
geom_bar(stat='identity',fill="dodgerblue2",alpha=0.25)+
theme_classic()+
xlab("Principal Component")+
ylab("Variation explained (%)")
```
```{r}
subplot(ggplotly(p1)%>% layout(legend = list(orientation = "h", x = 0.2, y =-0.15)), ggplotly(p2)%>%hide_legend(), ggplotly(pp)%>%hide_legend(), titleX=T,titleY=T,margin=0.035,widths=c(0.375,0.425,0.2),which_layout=1) %>% partial_bundle()
```
### maf = 0.40
```{r}
pca=PCA_list$Prune_filtered$maf0.4[[1]]
data_pca=data.frame(INDIV=pca$sample.id,
PC1=pca$eigenvect[,1],
PC2=pca$eigenvect[,2],
PC3=pca$eigenvect[,3],
PC4=pca$eigenvect[,4],
LOCA=c(rep("Algarve",5),
rep("Bay of Biscay",11),
rep("Gulf of Lion",5),
rep("Costa Calida",5)))
color_med_atl=rev(brewer.pal(n=4,name="RdBu"))
p<-ggplot(data=data_pca,aes(x=PC1,y=PC2,label=INDIV))+
theme_minimal()+
theme(panel.grid=element_blank(),
panel.border=element_rect(fill="transparent"),
plot.title=element_text(hjust=0.5))+
geom_hline(yintercept=0,lty=2)+
geom_vline(xintercept=0,lty=2)+
geom_point(size=3,aes(col=LOCA))+
xlab(paste("PCA 1 (",round(pca$varprop[1]*100,2),"% )",sep=""))+
ylab(paste("PCA 2 (",round(pca$varprop[2]*100,2),"% )",sep=""))+
scale_colour_manual(name="Location",
values=c(color_med_atl[2],
color_med_atl[1],
color_med_atl[3],
color_med_atl[4]))
p1<-p
p<-ggplot(data=data_pca,aes(x=PC3,y=PC4,label=INDIV))+
theme_minimal()+
theme(panel.grid=element_blank(),
panel.border=element_rect(fill="transparent"),
plot.title=element_text(hjust=0.5))+
geom_hline(yintercept=0,lty=2)+
geom_vline(xintercept=0,lty=2)+
geom_point(size=3,aes(col=LOCA))+
xlab(paste("PCA 3 (",round(pca$varprop[3]*100,2),"% )",sep=""))+
ylab(paste("PCA 4 (",round(pca$varprop[4]*100,2),"% )",sep=""))+
scale_colour_manual(name="Location",
values=c(color_med_atl[2],
color_med_atl[1],
color_med_atl[3],
color_med_atl[4]))
p2<-p
data_varpop=data.frame(PC=factor(paste("P",seq(1,10),sep=""),levels=paste("P",seq(1,10),sep="")),VAR=pca$varprop[1:10])
pp<-ggplot(data_varpop,aes(x=PC,y=VAR))+
geom_bar(stat='identity',fill="dodgerblue2",alpha=0.25)+
theme_classic()+
xlab("Principal Component")+
ylab("Variation explained (%)")
```
```{r}
subplot(ggplotly(p1)%>% layout(legend = list(orientation = "h", x = 0.2, y =-0.15)), ggplotly(p2)%>%hide_legend(), ggplotly(pp)%>%hide_legend(), titleX=T,titleY=T,margin=0.035,widths=c(0.375,0.425,0.2),which_layout=1) %>% partial_bundle()
```
### maf = 0.45
```{r}
pca=PCA_list$Prune_filtered$maf0.45[[1]]
data_pca=data.frame(INDIV=pca$sample.id,
PC1=pca$eigenvect[,1],
PC2=pca$eigenvect[,2],
PC3=pca$eigenvect[,3],
PC4=pca$eigenvect[,4],
LOCA=c(rep("Algarve",5),
rep("Bay of Biscay",11),
rep("Gulf of Lion",5),
rep("Costa Calida",5)))
color_med_atl=rev(brewer.pal(n=4,name="RdBu"))
p<-ggplot(data=data_pca,aes(x=PC1,y=PC2,label=INDIV))+
theme_minimal()+
theme(panel.grid=element_blank(),
panel.border=element_rect(fill="transparent"),
plot.title=element_text(hjust=0.5))+
geom_hline(yintercept=0,lty=2)+
geom_vline(xintercept=0,lty=2)+
geom_point(size=3,aes(col=LOCA))+
xlab(paste("PCA 1 (",round(pca$varprop[1]*100,2),"% )",sep=""))+
ylab(paste("PCA 2 (",round(pca$varprop[2]*100,2),"% )",sep=""))+
scale_colour_manual(name="Location",
values=c(color_med_atl[2],
color_med_atl[1],
color_med_atl[3],
color_med_atl[4]))
p1<-p
p<-ggplot(data=data_pca,aes(x=PC3,y=PC4,label=INDIV))+
theme_minimal()+
theme(panel.grid=element_blank(),
panel.border=element_rect(fill="transparent"),
plot.title=element_text(hjust=0.5))+
geom_hline(yintercept=0,lty=2)+
geom_vline(xintercept=0,lty=2)+
geom_point(size=3,aes(col=LOCA))+
xlab(paste("PCA 3 (",round(pca$varprop[3]*100,2),"% )",sep=""))+
ylab(paste("PCA 4 (",round(pca$varprop[4]*100,2),"% )",sep=""))+
scale_colour_manual(name="Location",
values=c(color_med_atl[2],
color_med_atl[1],
color_med_atl[3],
color_med_atl[4]))
p2<-p
data_varpop=data.frame(PC=factor(paste("P",seq(1,10),sep=""),levels=paste("P",seq(1,10),sep="")),VAR=pca$varprop[1:10])
pp<-ggplot(data_varpop,aes(x=PC,y=VAR))+
geom_bar(stat='identity',fill="dodgerblue2",alpha=0.25)+
theme_classic()+
xlab("Principal Component")+
ylab("Variation explained (%)")
```
```{r}
subplot(ggplotly(p1)%>% layout(legend = list(orientation = "h", x = 0.2, y =-0.15)), ggplotly(p2)%>%hide_legend(), ggplotly(pp)%>%hide_legend(), titleX=T,titleY=T,margin=0.035,widths=c(0.375,0.425,0.2),which_layout=1) %>% partial_bundle()
```
### maf = 0.50
```{r}
pca=PCA_list$Prune_filtered$maf0.5[[1]]
data_pca=data.frame(INDIV=pca$sample.id,
PC1=pca$eigenvect[,1],
PC2=pca$eigenvect[,2],
PC3=pca$eigenvect[,3],
PC4=pca$eigenvect[,4],
LOCA=c(rep("Algarve",5),
rep("Bay of Biscay",11),
rep("Gulf of Lion",5),
rep("Costa Calida",5)))
color_med_atl=rev(brewer.pal(n=4,name="RdBu"))
p<-ggplot(data=data_pca,aes(x=PC1,y=PC2,label=INDIV))+
theme_minimal()+
theme(panel.grid=element_blank(),
panel.border=element_rect(fill="transparent"),
plot.title=element_text(hjust=0.5))+
geom_hline(yintercept=0,lty=2)+
geom_vline(xintercept=0,lty=2)+
geom_point(size=3,aes(col=LOCA))+
xlab(paste("PCA 1 (",round(pca$varprop[1]*100,2),"% )",sep=""))+
ylab(paste("PCA 2 (",round(pca$varprop[2]*100,2),"% )",sep=""))+
scale_colour_manual(name="Location",
values=c(color_med_atl[2],
color_med_atl[1],
color_med_atl[3],
color_med_atl[4]))
p1<-p
p<-ggplot(data=data_pca,aes(x=PC3,y=PC4,label=INDIV))+
theme_minimal()+
theme(panel.grid=element_blank(),
panel.border=element_rect(fill="transparent"),
plot.title=element_text(hjust=0.5))+
geom_hline(yintercept=0,lty=2)+
geom_vline(xintercept=0,lty=2)+
geom_point(size=3,aes(col=LOCA))+
xlab(paste("PCA 3 (",round(pca$varprop[3]*100,2),"% )",sep=""))+
ylab(paste("PCA 4 (",round(pca$varprop[4]*100,2),"% )",sep=""))+
scale_colour_manual(name="Location",
values=c(color_med_atl[2],
color_med_atl[1],
color_med_atl[3],
color_med_atl[4]))
p2<-p
data_varpop=data.frame(PC=factor(paste("P",seq(1,10),sep=""),levels=paste("P",seq(1,10),sep="")),VAR=pca$varprop[1:10])
pp<-ggplot(data_varpop,aes(x=PC,y=VAR))+
geom_bar(stat='identity',fill="dodgerblue2",alpha=0.25)+
theme_classic()+
xlab("Principal Component")+
ylab("Variation explained (%)")
```
```{r}
subplot(ggplotly(p1)%>% layout(legend = list(orientation = "h", x = 0.2, y =-0.15)), ggplotly(p2)%>%hide_legend(), ggplotly(pp)%>%hide_legend(), titleX=T,titleY=T,margin=0.035,widths=c(0.375,0.425,0.2),which_layout=1) %>% partial_bundle()
```
Row {.tabset data-height=50}
-----------------------
<center>
<font size="6">**All unfiltered SNPS**</font>
</center>
Row {.tabset data-height=600}
-----------------------
### maf = 0
```{r}
pca=PCA_list$All_unfiltered$maf0[[1]]
data_pca=data.frame(INDIV=pca$sample.id,
PC1=pca$eigenvect[,1],
PC2=pca$eigenvect[,2],
PC3=pca$eigenvect[,3],
PC4=pca$eigenvect[,4],
LOCA=c(rep("Algarve",5),
rep("Bay of Biscay",11),
rep("Gulf of Lion",5),
rep("Costa Calida",5)))
color_med_atl=rev(brewer.pal(n=4,name="RdBu"))
p<-ggplot(data=data_pca,aes(x=PC1,y=PC2,label=INDIV))+
theme_minimal()+
theme(panel.grid=element_blank(),
panel.border=element_rect(fill="transparent"),
plot.title=element_text(hjust=0.5))+
geom_hline(yintercept=0,lty=2)+
geom_vline(xintercept=0,lty=2)+
geom_point(size=3,aes(col=LOCA))+
xlab(paste("PCA 1 (",round(pca$varprop[1]*100,2),"% )",sep=""))+
ylab(paste("PCA 2 (",round(pca$varprop[2]*100,2),"% )",sep=""))+
scale_colour_manual(name="Location",
values=c(color_med_atl[2],
color_med_atl[1],
color_med_atl[3],
color_med_atl[4]))
p1<-p
p<-ggplot(data=data_pca,aes(x=PC3,y=PC4,label=INDIV))+
theme_minimal()+
theme(panel.grid=element_blank(),
panel.border=element_rect(fill="transparent"),
plot.title=element_text(hjust=0.5))+
geom_hline(yintercept=0,lty=2)+
geom_vline(xintercept=0,lty=2)+
geom_point(size=3,aes(col=LOCA))+
xlab(paste("PCA 3 (",round(pca$varprop[3]*100,2),"% )",sep=""))+
ylab(paste("PCA 4 (",round(pca$varprop[4]*100,2),"% )",sep=""))+
scale_colour_manual(name="Location",
values=c(color_med_atl[2],
color_med_atl[1],
color_med_atl[3],
color_med_atl[4]))
p2<-p
data_varpop=data.frame(PC=factor(paste("P",seq(1,10),sep=""),levels=paste("P",seq(1,10),sep="")),VAR=pca$varprop[1:10])
pp<-ggplot(data_varpop,aes(x=PC,y=VAR))+
geom_bar(stat='identity',fill="dodgerblue2",alpha=0.25)+
theme_classic()+
xlab("Principal Component")+
ylab("Variation explained (%)")
```
```{r}
subplot(ggplotly(p1)%>% layout(legend = list(orientation = "h", x = 0.2, y =-0.15)), ggplotly(p2)%>%hide_legend(), ggplotly(pp)%>%hide_legend(), titleX=T,titleY=T,margin=0.035,widths=c(0.375,0.425,0.2),which_layout=1) %>% partial_bundle()
```
### maf = 0.05
```{r}
pca=PCA_list$All_unfiltered$maf0.05[[1]]
data_pca=data.frame(INDIV=pca$sample.id,
PC1=pca$eigenvect[,1],
PC2=pca$eigenvect[,2],
PC3=pca$eigenvect[,3],
PC4=pca$eigenvect[,4],
LOCA=c(rep("Algarve",5),
rep("Bay of Biscay",11),
rep("Gulf of Lion",5),
rep("Costa Calida",5)))
color_med_atl=rev(brewer.pal(n=4,name="RdBu"))
p<-ggplot(data=data_pca,aes(x=PC1,y=PC2,label=INDIV))+
theme_minimal()+
theme(panel.grid=element_blank(),
panel.border=element_rect(fill="transparent"),
plot.title=element_text(hjust=0.5))+
geom_hline(yintercept=0,lty=2)+
geom_vline(xintercept=0,lty=2)+
geom_point(size=3,aes(col=LOCA))+
xlab(paste("PCA 1 (",round(pca$varprop[1]*100,2),"% )",sep=""))+
ylab(paste("PCA 2 (",round(pca$varprop[2]*100,2),"% )",sep=""))+
scale_colour_manual(name="Location",
values=c(color_med_atl[2],
color_med_atl[1],
color_med_atl[3],
color_med_atl[4]))
p1<-p
p<-ggplot(data=data_pca,aes(x=PC3,y=PC4,label=INDIV))+
theme_minimal()+
theme(panel.grid=element_blank(),
panel.border=element_rect(fill="transparent"),
plot.title=element_text(hjust=0.5))+
geom_hline(yintercept=0,lty=2)+
geom_vline(xintercept=0,lty=2)+
geom_point(size=3,aes(col=LOCA))+
xlab(paste("PCA 3 (",round(pca$varprop[3]*100,2),"% )",sep=""))+
ylab(paste("PCA 4 (",round(pca$varprop[4]*100,2),"% )",sep=""))+
scale_colour_manual(name="Location",
values=c(color_med_atl[2],
color_med_atl[1],
color_med_atl[3],
color_med_atl[4]))
p2<-p
data_varpop=data.frame(PC=factor(paste("P",seq(1,10),sep=""),levels=paste("P",seq(1,10),sep="")),VAR=pca$varprop[1:10])
pp<-ggplot(data_varpop,aes(x=PC,y=VAR))+
geom_bar(stat='identity',fill="dodgerblue2",alpha=0.25)+
theme_classic()+
xlab("Principal Component")+
ylab("Variation explained (%)")
```
```{r}
subplot(ggplotly(p1)%>% layout(legend = list(orientation = "h", x = 0.2, y =-0.15)), ggplotly(p2)%>%hide_legend(), ggplotly(pp)%>%hide_legend(), titleX=T,titleY=T,margin=0.035,widths=c(0.375,0.425,0.2),which_layout=1) %>% partial_bundle()
```
### maf = 0.1
```{r}
pca=PCA_list$All_unfiltered$maf0.1[[1]]
data_pca=data.frame(INDIV=pca$sample.id,
PC1=pca$eigenvect[,1],
PC2=pca$eigenvect[,2],
PC3=pca$eigenvect[,3],
PC4=pca$eigenvect[,4],
LOCA=c(rep("Algarve",5),
rep("Bay of Biscay",11),
rep("Gulf of Lion",5),
rep("Costa Calida",5)))
color_med_atl=rev(brewer.pal(n=4,name="RdBu"))
p<-ggplot(data=data_pca,aes(x=PC1,y=PC2,label=INDIV))+
theme_minimal()+
theme(panel.grid=element_blank(),
panel.border=element_rect(fill="transparent"),
plot.title=element_text(hjust=0.5))+
geom_hline(yintercept=0,lty=2)+
geom_vline(xintercept=0,lty=2)+
geom_point(size=3,aes(col=LOCA))+
xlab(paste("PCA 1 (",round(pca$varprop[1]*100,2),"% )",sep=""))+
ylab(paste("PCA 2 (",round(pca$varprop[2]*100,2),"% )",sep=""))+
scale_colour_manual(name="Location",
values=c(color_med_atl[2],
color_med_atl[1],
color_med_atl[3],
color_med_atl[4]))
p1<-p
p<-ggplot(data=data_pca,aes(x=PC3,y=PC4,label=INDIV))+
theme_minimal()+
theme(panel.grid=element_blank(),
panel.border=element_rect(fill="transparent"),
plot.title=element_text(hjust=0.5))+
geom_hline(yintercept=0,lty=2)+
geom_vline(xintercept=0,lty=2)+
geom_point(size=3,aes(col=LOCA))+
xlab(paste("PCA 3 (",round(pca$varprop[3]*100,2),"% )",sep=""))+
ylab(paste("PCA 4 (",round(pca$varprop[4]*100,2),"% )",sep=""))+
scale_colour_manual(name="Location",
values=c(color_med_atl[2],
color_med_atl[1],
color_med_atl[3],
color_med_atl[4]))
p2<-p
data_varpop=data.frame(PC=factor(paste("P",seq(1,10),sep=""),levels=paste("P",seq(1,10),sep="")),VAR=pca$varprop[1:10])
pp<-ggplot(data_varpop,aes(x=PC,y=VAR))+
geom_bar(stat='identity',fill="dodgerblue2",alpha=0.25)+
theme_classic()+
xlab("Principal Component")+
ylab("Variation explained (%)")
```
```{r}
subplot(ggplotly(p1)%>% layout(legend = list(orientation = "h", x = 0.2, y =-0.15)), ggplotly(p2)%>%hide_legend(), ggplotly(pp)%>%hide_legend(), titleX=T,titleY=T,margin=0.035,widths=c(0.375,0.425,0.2),which_layout=1) %>% partial_bundle()
```
### maf = 0.15
```{r}
pca=PCA_list$All_unfiltered$maf0.15[[1]]
data_pca=data.frame(INDIV=pca$sample.id,
PC1=pca$eigenvect[,1],
PC2=pca$eigenvect[,2],
PC3=pca$eigenvect[,3],
PC4=pca$eigenvect[,4],
LOCA=c(rep("Algarve",5),
rep("Bay of Biscay",11),
rep("Gulf of Lion",5),
rep("Costa Calida",5)))
color_med_atl=rev(brewer.pal(n=4,name="RdBu"))
p<-ggplot(data=data_pca,aes(x=PC1,y=PC2,label=INDIV))+
theme_minimal()+
theme(panel.grid=element_blank(),
panel.border=element_rect(fill="transparent"),
plot.title=element_text(hjust=0.5))+
geom_hline(yintercept=0,lty=2)+
geom_vline(xintercept=0,lty=2)+
geom_point(size=3,aes(col=LOCA))+
xlab(paste("PCA 1 (",round(pca$varprop[1]*100,2),"% )",sep=""))+
ylab(paste("PCA 2 (",round(pca$varprop[2]*100,2),"% )",sep=""))+
scale_colour_manual(name="Location",
values=c(color_med_atl[2],
color_med_atl[1],
color_med_atl[3],
color_med_atl[4]))
p1<-p
p<-ggplot(data=data_pca,aes(x=PC3,y=PC4,label=INDIV))+
theme_minimal()+
theme(panel.grid=element_blank(),
panel.border=element_rect(fill="transparent"),
plot.title=element_text(hjust=0.5))+
geom_hline(yintercept=0,lty=2)+
geom_vline(xintercept=0,lty=2)+
geom_point(size=3,aes(col=LOCA))+
xlab(paste("PCA 3 (",round(pca$varprop[3]*100,2),"% )",sep=""))+
ylab(paste("PCA 4 (",round(pca$varprop[4]*100,2),"% )",sep=""))+
scale_colour_manual(name="Location",
values=c(color_med_atl[2],
color_med_atl[1],
color_med_atl[3],
color_med_atl[4]))
p2<-p
data_varpop=data.frame(PC=factor(paste("P",seq(1,10),sep=""),levels=paste("P",seq(1,10),sep="")),VAR=pca$varprop[1:10])
pp<-ggplot(data_varpop,aes(x=PC,y=VAR))+
geom_bar(stat='identity',fill="dodgerblue2",alpha=0.25)+
theme_classic()+
xlab("Principal Component")+
ylab("Variation explained (%)")
```
```{r}
subplot(ggplotly(p1)%>% layout(legend = list(orientation = "h", x = 0.2, y =-0.15)), ggplotly(p2)%>%hide_legend(), ggplotly(pp)%>%hide_legend(), titleX=T,titleY=T,margin=0.035,widths=c(0.375,0.425,0.2),which_layout=1) %>% partial_bundle()
```
### maf = 0.20
```{r}
pca=PCA_list$All_unfiltered$maf0.2[[1]]
data_pca=data.frame(INDIV=pca$sample.id,
PC1=pca$eigenvect[,1],
PC2=pca$eigenvect[,2],
PC3=pca$eigenvect[,3],
PC4=pca$eigenvect[,4],
LOCA=c(rep("Algarve",5),
rep("Bay of Biscay",11),
rep("Gulf of Lion",5),
rep("Costa Calida",5)))
color_med_atl=rev(brewer.pal(n=4,name="RdBu"))
p<-ggplot(data=data_pca,aes(x=PC1,y=PC2,label=INDIV))+
theme_minimal()+
theme(panel.grid=element_blank(),
panel.border=element_rect(fill="transparent"),
plot.title=element_text(hjust=0.5))+
geom_hline(yintercept=0,lty=2)+
geom_vline(xintercept=0,lty=2)+
geom_point(size=3,aes(col=LOCA))+
xlab(paste("PCA 1 (",round(pca$varprop[1]*100,2),"% )",sep=""))+
ylab(paste("PCA 2 (",round(pca$varprop[2]*100,2),"% )",sep=""))+
scale_colour_manual(name="Location",
values=c(color_med_atl[2],
color_med_atl[1],
color_med_atl[3],
color_med_atl[4]))
p1<-p
p<-ggplot(data=data_pca,aes(x=PC3,y=PC4,label=INDIV))+
theme_minimal()+
theme(panel.grid=element_blank(),
panel.border=element_rect(fill="transparent"),
plot.title=element_text(hjust=0.5))+
geom_hline(yintercept=0,lty=2)+
geom_vline(xintercept=0,lty=2)+
geom_point(size=3,aes(col=LOCA))+
xlab(paste("PCA 3 (",round(pca$varprop[3]*100,2),"% )",sep=""))+
ylab(paste("PCA 4 (",round(pca$varprop[4]*100,2),"% )",sep=""))+
scale_colour_manual(name="Location",
values=c(color_med_atl[2],
color_med_atl[1],
color_med_atl[3],
color_med_atl[4]))
p2<-p
data_varpop=data.frame(PC=factor(paste("P",seq(1,10),sep=""),levels=paste("P",seq(1,10),sep="")),VAR=pca$varprop[1:10])
pp<-ggplot(data_varpop,aes(x=PC,y=VAR))+
geom_bar(stat='identity',fill="dodgerblue2",alpha=0.25)+
theme_classic()+
xlab("Principal Component")+
ylab("Variation explained (%)")
```
```{r}
subplot(ggplotly(p1)%>% layout(legend = list(orientation = "h", x = 0.2, y =-0.15)), ggplotly(p2)%>%hide_legend(), ggplotly(pp)%>%hide_legend(), titleX=T,titleY=T,margin=0.035,widths=c(0.375,0.425,0.2),which_layout=1) %>% partial_bundle()
```
### maf = 0.25
```{r}
pca=PCA_list$All_unfiltered$maf0.25[[1]]
data_pca=data.frame(INDIV=pca$sample.id,
PC1=pca$eigenvect[,1],
PC2=pca$eigenvect[,2],
PC3=pca$eigenvect[,3],
PC4=pca$eigenvect[,4],
LOCA=c(rep("Algarve",5),
rep("Bay of Biscay",11),
rep("Gulf of Lion",5),
rep("Costa Calida",5)))
color_med_atl=rev(brewer.pal(n=4,name="RdBu"))
p<-ggplot(data=data_pca,aes(x=PC1,y=PC2,label=INDIV))+
theme_minimal()+
theme(panel.grid=element_blank(),
panel.border=element_rect(fill="transparent"),
plot.title=element_text(hjust=0.5))+
geom_hline(yintercept=0,lty=2)+
geom_vline(xintercept=0,lty=2)+
geom_point(size=3,aes(col=LOCA))+
xlab(paste("PCA 1 (",round(pca$varprop[1]*100,2),"% )",sep=""))+
ylab(paste("PCA 2 (",round(pca$varprop[2]*100,2),"% )",sep=""))+
scale_colour_manual(name="Location",
values=c(color_med_atl[2],
color_med_atl[1],
color_med_atl[3],
color_med_atl[4]))
p1<-p
p<-ggplot(data=data_pca,aes(x=PC3,y=PC4,label=INDIV))+
theme_minimal()+
theme(panel.grid=element_blank(),
panel.border=element_rect(fill="transparent"),
plot.title=element_text(hjust=0.5))+
geom_hline(yintercept=0,lty=2)+
geom_vline(xintercept=0,lty=2)+
geom_point(size=3,aes(col=LOCA))+
xlab(paste("PCA 3 (",round(pca$varprop[3]*100,2),"% )",sep=""))+
ylab(paste("PCA 4 (",round(pca$varprop[4]*100,2),"% )",sep=""))+
scale_colour_manual(name="Location",
values=c(color_med_atl[2],
color_med_atl[1],
color_med_atl[3],
color_med_atl[4]))
p2<-p
data_varpop=data.frame(PC=factor(paste("P",seq(1,10),sep=""),levels=paste("P",seq(1,10),sep="")),VAR=pca$varprop[1:10])
pp<-ggplot(data_varpop,aes(x=PC,y=VAR))+
geom_bar(stat='identity',fill="dodgerblue2",alpha=0.25)+
theme_classic()+
xlab("Principal Component")+
ylab("Variation explained (%)")
```
```{r}
subplot(ggplotly(p1)%>% layout(legend = list(orientation = "h", x = 0.2, y =-0.15)), ggplotly(p2)%>%hide_legend(), ggplotly(pp)%>%hide_legend(), titleX=T,titleY=T,margin=0.035,widths=c(0.375,0.425,0.2),which_layout=1) %>% partial_bundle()
```
### maf = 0.30
```{r}
pca=PCA_list$All_unfiltered$maf0.3[[1]]
data_pca=data.frame(INDIV=pca$sample.id,
PC1=pca$eigenvect[,1],
PC2=pca$eigenvect[,2],
PC3=pca$eigenvect[,3],
PC4=pca$eigenvect[,4],
LOCA=c(rep("Algarve",5),
rep("Bay of Biscay",11),
rep("Gulf of Lion",5),
rep("Costa Calida",5)))
color_med_atl=rev(brewer.pal(n=4,name="RdBu"))
p<-ggplot(data=data_pca,aes(x=PC1,y=PC2,label=INDIV))+
theme_minimal()+
theme(panel.grid=element_blank(),
panel.border=element_rect(fill="transparent"),
plot.title=element_text(hjust=0.5))+
geom_hline(yintercept=0,lty=2)+
geom_vline(xintercept=0,lty=2)+
geom_point(size=3,aes(col=LOCA))+
xlab(paste("PCA 1 (",round(pca$varprop[1]*100,2),"% )",sep=""))+
ylab(paste("PCA 2 (",round(pca$varprop[2]*100,2),"% )",sep=""))+
scale_colour_manual(name="Location",
values=c(color_med_atl[2],
color_med_atl[1],
color_med_atl[3],
color_med_atl[4]))
p1<-p
p<-ggplot(data=data_pca,aes(x=PC3,y=PC4,label=INDIV))+
theme_minimal()+
theme(panel.grid=element_blank(),
panel.border=element_rect(fill="transparent"),
plot.title=element_text(hjust=0.5))+
geom_hline(yintercept=0,lty=2)+
geom_vline(xintercept=0,lty=2)+
geom_point(size=3,aes(col=LOCA))+
xlab(paste("PCA 3 (",round(pca$varprop[3]*100,2),"% )",sep=""))+
ylab(paste("PCA 4 (",round(pca$varprop[4]*100,2),"% )",sep=""))+
scale_colour_manual(name="Location",
values=c(color_med_atl[2],
color_med_atl[1],
color_med_atl[3],
color_med_atl[4]))
p2<-p
data_varpop=data.frame(PC=factor(paste("P",seq(1,10),sep=""),levels=paste("P",seq(1,10),sep="")),VAR=pca$varprop[1:10])
pp<-ggplot(data_varpop,aes(x=PC,y=VAR))+
geom_bar(stat='identity',fill="dodgerblue2",alpha=0.25)+
theme_classic()+
xlab("Principal Component")+
ylab("Variation explained (%)")
```
```{r}
subplot(ggplotly(p1)%>% layout(legend = list(orientation = "h", x = 0.2, y =-0.15)), ggplotly(p2)%>%hide_legend(), ggplotly(pp)%>%hide_legend(), titleX=T,titleY=T,margin=0.035,widths=c(0.375,0.425,0.2),which_layout=1) %>% partial_bundle()
```
### maf = 0.35
```{r}
pca=PCA_list$All_unfiltered$maf0.35[[1]]
data_pca=data.frame(INDIV=pca$sample.id,
PC1=pca$eigenvect[,1],
PC2=pca$eigenvect[,2],
PC3=pca$eigenvect[,3],
PC4=pca$eigenvect[,4],
LOCA=c(rep("Algarve",5),
rep("Bay of Biscay",11),
rep("Gulf of Lion",5),
rep("Costa Calida",5)))
color_med_atl=rev(brewer.pal(n=4,name="RdBu"))
p<-ggplot(data=data_pca,aes(x=PC1,y=PC2,label=INDIV))+
theme_minimal()+
theme(panel.grid=element_blank(),
panel.border=element_rect(fill="transparent"),
plot.title=element_text(hjust=0.5))+
geom_hline(yintercept=0,lty=2)+
geom_vline(xintercept=0,lty=2)+
geom_point(size=3,aes(col=LOCA))+
xlab(paste("PCA 1 (",round(pca$varprop[1]*100,2),"% )",sep=""))+
ylab(paste("PCA 2 (",round(pca$varprop[2]*100,2),"% )",sep=""))+
scale_colour_manual(name="Location",
values=c(color_med_atl[2],
color_med_atl[1],
color_med_atl[3],
color_med_atl[4]))
p1<-p
p<-ggplot(data=data_pca,aes(x=PC3,y=PC4,label=INDIV))+
theme_minimal()+
theme(panel.grid=element_blank(),
panel.border=element_rect(fill="transparent"),
plot.title=element_text(hjust=0.5))+
geom_hline(yintercept=0,lty=2)+
geom_vline(xintercept=0,lty=2)+
geom_point(size=3,aes(col=LOCA))+
xlab(paste("PCA 3 (",round(pca$varprop[3]*100,2),"% )",sep=""))+
ylab(paste("PCA 4 (",round(pca$varprop[4]*100,2),"% )",sep=""))+
scale_colour_manual(name="Location",
values=c(color_med_atl[2],
color_med_atl[1],
color_med_atl[3],
color_med_atl[4]))
p2<-p
data_varpop=data.frame(PC=factor(paste("P",seq(1,10),sep=""),levels=paste("P",seq(1,10),sep="")),VAR=pca$varprop[1:10])
pp<-ggplot(data_varpop,aes(x=PC,y=VAR))+
geom_bar(stat='identity',fill="dodgerblue2",alpha=0.25)+
theme_classic()+
xlab("Principal Component")+
ylab("Variation explained (%)")
```
```{r}
subplot(ggplotly(p1)%>% layout(legend = list(orientation = "h", x = 0.2, y =-0.15)), ggplotly(p2)%>%hide_legend(), ggplotly(pp)%>%hide_legend(), titleX=T,titleY=T,margin=0.035,widths=c(0.375,0.425,0.2),which_layout=1) %>% partial_bundle()
```
### maf = 0.40
```{r}
pca=PCA_list$All_unfiltered$maf0.4[[1]]
data_pca=data.frame(INDIV=pca$sample.id,
PC1=pca$eigenvect[,1],
PC2=pca$eigenvect[,2],
PC3=pca$eigenvect[,3],
PC4=pca$eigenvect[,4],
LOCA=c(rep("Algarve",5),
rep("Bay of Biscay",11),
rep("Gulf of Lion",5),
rep("Costa Calida",5)))
color_med_atl=rev(brewer.pal(n=4,name="RdBu"))
p<-ggplot(data=data_pca,aes(x=PC1,y=PC2,label=INDIV))+
theme_minimal()+
theme(panel.grid=element_blank(),
panel.border=element_rect(fill="transparent"),
plot.title=element_text(hjust=0.5))+
geom_hline(yintercept=0,lty=2)+
geom_vline(xintercept=0,lty=2)+
geom_point(size=3,aes(col=LOCA))+
xlab(paste("PCA 1 (",round(pca$varprop[1]*100,2),"% )",sep=""))+
ylab(paste("PCA 2 (",round(pca$varprop[2]*100,2),"% )",sep=""))+
scale_colour_manual(name="Location",
values=c(color_med_atl[2],
color_med_atl[1],
color_med_atl[3],
color_med_atl[4]))
p1<-p
p<-ggplot(data=data_pca,aes(x=PC3,y=PC4,label=INDIV))+
theme_minimal()+
theme(panel.grid=element_blank(),
panel.border=element_rect(fill="transparent"),
plot.title=element_text(hjust=0.5))+
geom_hline(yintercept=0,lty=2)+
geom_vline(xintercept=0,lty=2)+
geom_point(size=3,aes(col=LOCA))+
xlab(paste("PCA 3 (",round(pca$varprop[3]*100,2),"% )",sep=""))+
ylab(paste("PCA 4 (",round(pca$varprop[4]*100,2),"% )",sep=""))+
scale_colour_manual(name="Location",
values=c(color_med_atl[2],
color_med_atl[1],
color_med_atl[3],
color_med_atl[4]))
p2<-p
data_varpop=data.frame(PC=factor(paste("P",seq(1,10),sep=""),levels=paste("P",seq(1,10),sep="")),VAR=pca$varprop[1:10])
pp<-ggplot(data_varpop,aes(x=PC,y=VAR))+
geom_bar(stat='identity',fill="dodgerblue2",alpha=0.25)+
theme_classic()+
xlab("Principal Component")+
ylab("Variation explained (%)")
```
```{r}
subplot(ggplotly(p1)%>% layout(legend = list(orientation = "h", x = 0.2, y =-0.15)), ggplotly(p2)%>%hide_legend(), ggplotly(pp)%>%hide_legend(), titleX=T,titleY=T,margin=0.035,widths=c(0.375,0.425,0.2),which_layout=1) %>% partial_bundle()
```
### maf = 0.45
```{r}
pca=PCA_list$All_unfiltered$maf0.45[[1]]
data_pca=data.frame(INDIV=pca$sample.id,
PC1=pca$eigenvect[,1],
PC2=pca$eigenvect[,2],
PC3=pca$eigenvect[,3],
PC4=pca$eigenvect[,4],
LOCA=c(rep("Algarve",5),
rep("Bay of Biscay",11),
rep("Gulf of Lion",5),
rep("Costa Calida",5)))
color_med_atl=rev(brewer.pal(n=4,name="RdBu"))
p<-ggplot(data=data_pca,aes(x=PC1,y=PC2,label=INDIV))+
theme_minimal()+
theme(panel.grid=element_blank(),
panel.border=element_rect(fill="transparent"),
plot.title=element_text(hjust=0.5))+
geom_hline(yintercept=0,lty=2)+
geom_vline(xintercept=0,lty=2)+
geom_point(size=3,aes(col=LOCA))+
xlab(paste("PCA 1 (",round(pca$varprop[1]*100,2),"% )",sep=""))+
ylab(paste("PCA 2 (",round(pca$varprop[2]*100,2),"% )",sep=""))+
scale_colour_manual(name="Location",
values=c(color_med_atl[2],
color_med_atl[1],
color_med_atl[3],
color_med_atl[4]))
p1<-p
p<-ggplot(data=data_pca,aes(x=PC3,y=PC4,label=INDIV))+
theme_minimal()+
theme(panel.grid=element_blank(),
panel.border=element_rect(fill="transparent"),
plot.title=element_text(hjust=0.5))+
geom_hline(yintercept=0,lty=2)+
geom_vline(xintercept=0,lty=2)+
geom_point(size=3,aes(col=LOCA))+
xlab(paste("PCA 3 (",round(pca$varprop[3]*100,2),"% )",sep=""))+
ylab(paste("PCA 4 (",round(pca$varprop[4]*100,2),"% )",sep=""))+
scale_colour_manual(name="Location",
values=c(color_med_atl[2],
color_med_atl[1],
color_med_atl[3],
color_med_atl[4]))
p2<-p
data_varpop=data.frame(PC=factor(paste("P",seq(1,10),sep=""),levels=paste("P",seq(1,10),sep="")),VAR=pca$varprop[1:10])
pp<-ggplot(data_varpop,aes(x=PC,y=VAR))+
geom_bar(stat='identity',fill="dodgerblue2",alpha=0.25)+
theme_classic()+
xlab("Principal Component")+
ylab("Variation explained (%)")
```
```{r}
subplot(ggplotly(p1)%>% layout(legend = list(orientation = "h", x = 0.2, y =-0.15)), ggplotly(p2)%>%hide_legend(), ggplotly(pp)%>%hide_legend(), titleX=T,titleY=T,margin=0.035,widths=c(0.375,0.425,0.2),which_layout=1) %>% partial_bundle()
```
### maf = 0.50
```{r}
pca=PCA_list$All_unfiltered$maf0.5[[1]]
data_pca=data.frame(INDIV=pca$sample.id,
PC1=pca$eigenvect[,1],
PC2=pca$eigenvect[,2],
PC3=pca$eigenvect[,3],
PC4=pca$eigenvect[,4],
LOCA=c(rep("Algarve",5),
rep("Bay of Biscay",11),
rep("Gulf of Lion",5),
rep("Costa Calida",5)))
color_med_atl=rev(brewer.pal(n=4,name="RdBu"))
p<-ggplot(data=data_pca,aes(x=PC1,y=PC2,label=INDIV))+
theme_minimal()+
theme(panel.grid=element_blank(),
panel.border=element_rect(fill="transparent"),
plot.title=element_text(hjust=0.5))+
geom_hline(yintercept=0,lty=2)+
geom_vline(xintercept=0,lty=2)+
geom_point(size=3,aes(col=LOCA))+
xlab(paste("PCA 1 (",round(pca$varprop[1]*100,2),"% )",sep=""))+
ylab(paste("PCA 2 (",round(pca$varprop[2]*100,2),"% )",sep=""))+
scale_colour_manual(name="Location",
values=c(color_med_atl[2],
color_med_atl[1],
color_med_atl[3],
color_med_atl[4]))
p1<-p
p<-ggplot(data=data_pca,aes(x=PC3,y=PC4,label=INDIV))+
theme_minimal()+
theme(panel.grid=element_blank(),
panel.border=element_rect(fill="transparent"),
plot.title=element_text(hjust=0.5))+
geom_hline(yintercept=0,lty=2)+
geom_vline(xintercept=0,lty=2)+
geom_point(size=3,aes(col=LOCA))+
xlab(paste("PCA 3 (",round(pca$varprop[3]*100,2),"% )",sep=""))+
ylab(paste("PCA 4 (",round(pca$varprop[4]*100,2),"% )",sep=""))+
scale_colour_manual(name="Location",
values=c(color_med_atl[2],
color_med_atl[1],
color_med_atl[3],
color_med_atl[4]))
p2<-p
data_varpop=data.frame(PC=factor(paste("P",seq(1,10),sep=""),levels=paste("P",seq(1,10),sep="")),VAR=pca$varprop[1:10])
pp<-ggplot(data_varpop,aes(x=PC,y=VAR))+
geom_bar(stat='identity',fill="dodgerblue2",alpha=0.25)+
theme_classic()+
xlab("Principal Component")+
ylab("Variation explained (%)")
```
```{r}
subplot(ggplotly(p1)%>% layout(legend = list(orientation = "h", x = 0.2, y =-0.15)), ggplotly(p2)%>%hide_legend(), ggplotly(pp)%>%hide_legend(), titleX=T,titleY=T,margin=0.035,widths=c(0.375,0.425,0.2),which_layout=1) %>% partial_bundle()
```
Row {.tabset data-height=50}
-----------------------
<center>
<font size="6">**Pruned unfiltered SNPS**</font>
</center>
Row {.tabset data-height=600}
-----------------------
### maf = 0
```{r}
pca=PCA_list$Prune_unfiltered$maf0[[1]]
data_pca=data.frame(INDIV=pca$sample.id,
PC1=pca$eigenvect[,1],
PC2=pca$eigenvect[,2],
PC3=pca$eigenvect[,3],
PC4=pca$eigenvect[,4],
LOCA=c(rep("Algarve",5),
rep("Bay of Biscay",11),
rep("Gulf of Lion",5),
rep("Costa Calida",5)))
color_med_atl=rev(brewer.pal(n=4,name="RdBu"))
p<-ggplot(data=data_pca,aes(x=PC1,y=PC2,label=INDIV))+
theme_minimal()+
theme(panel.grid=element_blank(),
panel.border=element_rect(fill="transparent"),
plot.title=element_text(hjust=0.5))+
geom_hline(yintercept=0,lty=2)+
geom_vline(xintercept=0,lty=2)+
geom_point(size=3,aes(col=LOCA))+
xlab(paste("PCA 1 (",round(pca$varprop[1]*100,2),"% )",sep=""))+
ylab(paste("PCA 2 (",round(pca$varprop[2]*100,2),"% )",sep=""))+
scale_colour_manual(name="Location",
values=c(color_med_atl[2],
color_med_atl[1],
color_med_atl[3],
color_med_atl[4]))
p1<-p
p<-ggplot(data=data_pca,aes(x=PC3,y=PC4,label=INDIV))+
theme_minimal()+
theme(panel.grid=element_blank(),
panel.border=element_rect(fill="transparent"),
plot.title=element_text(hjust=0.5))+
geom_hline(yintercept=0,lty=2)+
geom_vline(xintercept=0,lty=2)+
geom_point(size=3,aes(col=LOCA))+
xlab(paste("PCA 3 (",round(pca$varprop[3]*100,2),"% )",sep=""))+
ylab(paste("PCA 4 (",round(pca$varprop[4]*100,2),"% )",sep=""))+
scale_colour_manual(name="Location",
values=c(color_med_atl[2],
color_med_atl[1],
color_med_atl[3],
color_med_atl[4]))
p2<-p
data_varpop=data.frame(PC=factor(paste("P",seq(1,10),sep=""),levels=paste("P",seq(1,10),sep="")),VAR=pca$varprop[1:10])
pp<-ggplot(data_varpop,aes(x=PC,y=VAR))+
geom_bar(stat='identity',fill="dodgerblue2",alpha=0.25)+
theme_classic()+
xlab("Principal Component")+
ylab("Variation explained (%)")
```
```{r}
subplot(ggplotly(p1)%>% layout(legend = list(orientation = "h", x = 0.2, y =-0.15)), ggplotly(p2)%>%hide_legend(), ggplotly(pp)%>%hide_legend(), titleX=T,titleY=T,margin=0.035,widths=c(0.375,0.425,0.2),which_layout=1) %>% partial_bundle()
```
### maf = 0.05
```{r}
pca=PCA_list$Prune_unfiltered$maf0.05[[1]]
data_pca=data.frame(INDIV=pca$sample.id,
PC1=pca$eigenvect[,1],
PC2=pca$eigenvect[,2],
PC3=pca$eigenvect[,3],
PC4=pca$eigenvect[,4],
LOCA=c(rep("Algarve",5),
rep("Bay of Biscay",11),
rep("Gulf of Lion",5),
rep("Costa Calida",5)))
color_med_atl=rev(brewer.pal(n=4,name="RdBu"))
p<-ggplot(data=data_pca,aes(x=PC1,y=PC2,label=INDIV))+
theme_minimal()+
theme(panel.grid=element_blank(),
panel.border=element_rect(fill="transparent"),
plot.title=element_text(hjust=0.5))+
geom_hline(yintercept=0,lty=2)+
geom_vline(xintercept=0,lty=2)+
geom_point(size=3,aes(col=LOCA))+
xlab(paste("PCA 1 (",round(pca$varprop[1]*100,2),"% )",sep=""))+
ylab(paste("PCA 2 (",round(pca$varprop[2]*100,2),"% )",sep=""))+
scale_colour_manual(name="Location",
values=c(color_med_atl[2],
color_med_atl[1],
color_med_atl[3],
color_med_atl[4]))
p1<-p
p<-ggplot(data=data_pca,aes(x=PC3,y=PC4,label=INDIV))+
theme_minimal()+
theme(panel.grid=element_blank(),
panel.border=element_rect(fill="transparent"),
plot.title=element_text(hjust=0.5))+
geom_hline(yintercept=0,lty=2)+
geom_vline(xintercept=0,lty=2)+
geom_point(size=3,aes(col=LOCA))+
xlab(paste("PCA 3 (",round(pca$varprop[3]*100,2),"% )",sep=""))+
ylab(paste("PCA 4 (",round(pca$varprop[4]*100,2),"% )",sep=""))+
scale_colour_manual(name="Location",
values=c(color_med_atl[2],
color_med_atl[1],
color_med_atl[3],
color_med_atl[4]))
p2<-p
data_varpop=data.frame(PC=factor(paste("P",seq(1,10),sep=""),levels=paste("P",seq(1,10),sep="")),VAR=pca$varprop[1:10])
pp<-ggplot(data_varpop,aes(x=PC,y=VAR))+
geom_bar(stat='identity',fill="dodgerblue2",alpha=0.25)+
theme_classic()+
xlab("Principal Component")+
ylab("Variation explained (%)")
```
```{r}
subplot(ggplotly(p1)%>% layout(legend = list(orientation = "h", x = 0.2, y =-0.15)), ggplotly(p2)%>%hide_legend(), ggplotly(pp)%>%hide_legend(), titleX=T,titleY=T,margin=0.035,widths=c(0.375,0.425,0.2),which_layout=1) %>% partial_bundle()
```
### maf = 0.1
```{r}
pca=PCA_list$Prune_unfiltered$maf0.1[[1]]
data_pca=data.frame(INDIV=pca$sample.id,
PC1=pca$eigenvect[,1],
PC2=pca$eigenvect[,2],
PC3=pca$eigenvect[,3],
PC4=pca$eigenvect[,4],
LOCA=c(rep("Algarve",5),
rep("Bay of Biscay",11),
rep("Gulf of Lion",5),
rep("Costa Calida",5)))
color_med_atl=rev(brewer.pal(n=4,name="RdBu"))
p<-ggplot(data=data_pca,aes(x=PC1,y=PC2,label=INDIV))+
theme_minimal()+
theme(panel.grid=element_blank(),
panel.border=element_rect(fill="transparent"),
plot.title=element_text(hjust=0.5))+
geom_hline(yintercept=0,lty=2)+
geom_vline(xintercept=0,lty=2)+
geom_point(size=3,aes(col=LOCA))+
xlab(paste("PCA 1 (",round(pca$varprop[1]*100,2),"% )",sep=""))+
ylab(paste("PCA 2 (",round(pca$varprop[2]*100,2),"% )",sep=""))+
scale_colour_manual(name="Location",
values=c(color_med_atl[2],
color_med_atl[1],
color_med_atl[3],
color_med_atl[4]))
p1<-p
p<-ggplot(data=data_pca,aes(x=PC3,y=PC4,label=INDIV))+
theme_minimal()+
theme(panel.grid=element_blank(),
panel.border=element_rect(fill="transparent"),
plot.title=element_text(hjust=0.5))+
geom_hline(yintercept=0,lty=2)+
geom_vline(xintercept=0,lty=2)+
geom_point(size=3,aes(col=LOCA))+
xlab(paste("PCA 3 (",round(pca$varprop[3]*100,2),"% )",sep=""))+
ylab(paste("PCA 4 (",round(pca$varprop[4]*100,2),"% )",sep=""))+
scale_colour_manual(name="Location",
values=c(color_med_atl[2],
color_med_atl[1],
color_med_atl[3],
color_med_atl[4]))
p2<-p
data_varpop=data.frame(PC=factor(paste("P",seq(1,10),sep=""),levels=paste("P",seq(1,10),sep="")),VAR=pca$varprop[1:10])
pp<-ggplot(data_varpop,aes(x=PC,y=VAR))+
geom_bar(stat='identity',fill="dodgerblue2",alpha=0.25)+
theme_classic()+
xlab("Principal Component")+
ylab("Variation explained (%)")
```
```{r}
subplot(ggplotly(p1)%>% layout(legend = list(orientation = "h", x = 0.2, y =-0.15)), ggplotly(p2)%>%hide_legend(), ggplotly(pp)%>%hide_legend(), titleX=T,titleY=T,margin=0.035,widths=c(0.375,0.425,0.2),which_layout=1) %>% partial_bundle()
```
### maf = 0.15
```{r}
pca=PCA_list$Prune_unfiltered$maf0.15[[1]]
data_pca=data.frame(INDIV=pca$sample.id,
PC1=pca$eigenvect[,1],
PC2=pca$eigenvect[,2],
PC3=pca$eigenvect[,3],
PC4=pca$eigenvect[,4],
LOCA=c(rep("Algarve",5),
rep("Bay of Biscay",11),
rep("Gulf of Lion",5),
rep("Costa Calida",5)))
color_med_atl=rev(brewer.pal(n=4,name="RdBu"))
p<-ggplot(data=data_pca,aes(x=PC1,y=PC2,label=INDIV))+
theme_minimal()+
theme(panel.grid=element_blank(),
panel.border=element_rect(fill="transparent"),
plot.title=element_text(hjust=0.5))+
geom_hline(yintercept=0,lty=2)+
geom_vline(xintercept=0,lty=2)+
geom_point(size=3,aes(col=LOCA))+
xlab(paste("PCA 1 (",round(pca$varprop[1]*100,2),"% )",sep=""))+
ylab(paste("PCA 2 (",round(pca$varprop[2]*100,2),"% )",sep=""))+
scale_colour_manual(name="Location",
values=c(color_med_atl[2],
color_med_atl[1],
color_med_atl[3],
color_med_atl[4]))
p1<-p
p<-ggplot(data=data_pca,aes(x=PC3,y=PC4,label=INDIV))+
theme_minimal()+
theme(panel.grid=element_blank(),
panel.border=element_rect(fill="transparent"),
plot.title=element_text(hjust=0.5))+
geom_hline(yintercept=0,lty=2)+
geom_vline(xintercept=0,lty=2)+
geom_point(size=3,aes(col=LOCA))+
xlab(paste("PCA 3 (",round(pca$varprop[3]*100,2),"% )",sep=""))+
ylab(paste("PCA 4 (",round(pca$varprop[4]*100,2),"% )",sep=""))+
scale_colour_manual(name="Location",
values=c(color_med_atl[2],
color_med_atl[1],
color_med_atl[3],
color_med_atl[4]))
p2<-p
data_varpop=data.frame(PC=factor(paste("P",seq(1,10),sep=""),levels=paste("P",seq(1,10),sep="")),VAR=pca$varprop[1:10])
pp<-ggplot(data_varpop,aes(x=PC,y=VAR))+
geom_bar(stat='identity',fill="dodgerblue2",alpha=0.25)+
theme_classic()+
xlab("Principal Component")+
ylab("Variation explained (%)")
```
```{r}
subplot(ggplotly(p1)%>% layout(legend = list(orientation = "h", x = 0.2, y =-0.15)), ggplotly(p2)%>%hide_legend(), ggplotly(pp)%>%hide_legend(), titleX=T,titleY=T,margin=0.035,widths=c(0.375,0.425,0.2),which_layout=1) %>% partial_bundle()
```
### maf = 0.20
```{r}
pca=PCA_list$Prune_unfiltered$maf0.2[[1]]
data_pca=data.frame(INDIV=pca$sample.id,
PC1=pca$eigenvect[,1],
PC2=pca$eigenvect[,2],
PC3=pca$eigenvect[,3],
PC4=pca$eigenvect[,4],
LOCA=c(rep("Algarve",5),
rep("Bay of Biscay",11),
rep("Gulf of Lion",5),
rep("Costa Calida",5)))
color_med_atl=rev(brewer.pal(n=4,name="RdBu"))
p<-ggplot(data=data_pca,aes(x=PC1,y=PC2,label=INDIV))+
theme_minimal()+
theme(panel.grid=element_blank(),
panel.border=element_rect(fill="transparent"),
plot.title=element_text(hjust=0.5))+
geom_hline(yintercept=0,lty=2)+
geom_vline(xintercept=0,lty=2)+
geom_point(size=3,aes(col=LOCA))+
xlab(paste("PCA 1 (",round(pca$varprop[1]*100,2),"% )",sep=""))+
ylab(paste("PCA 2 (",round(pca$varprop[2]*100,2),"% )",sep=""))+
scale_colour_manual(name="Location",
values=c(color_med_atl[2],
color_med_atl[1],
color_med_atl[3],
color_med_atl[4]))
p1<-p
p<-ggplot(data=data_pca,aes(x=PC3,y=PC4,label=INDIV))+
theme_minimal()+
theme(panel.grid=element_blank(),
panel.border=element_rect(fill="transparent"),
plot.title=element_text(hjust=0.5))+
geom_hline(yintercept=0,lty=2)+
geom_vline(xintercept=0,lty=2)+
geom_point(size=3,aes(col=LOCA))+
xlab(paste("PCA 3 (",round(pca$varprop[3]*100,2),"% )",sep=""))+
ylab(paste("PCA 4 (",round(pca$varprop[4]*100,2),"% )",sep=""))+
scale_colour_manual(name="Location",
values=c(color_med_atl[2],
color_med_atl[1],
color_med_atl[3],
color_med_atl[4]))
p2<-p
data_varpop=data.frame(PC=factor(paste("P",seq(1,10),sep=""),levels=paste("P",seq(1,10),sep="")),VAR=pca$varprop[1:10])
pp<-ggplot(data_varpop,aes(x=PC,y=VAR))+
geom_bar(stat='identity',fill="dodgerblue2",alpha=0.25)+
theme_classic()+
xlab("Principal Component")+
ylab("Variation explained (%)")
```
```{r}
subplot(ggplotly(p1)%>% layout(legend = list(orientation = "h", x = 0.2, y =-0.15)), ggplotly(p2)%>%hide_legend(), ggplotly(pp)%>%hide_legend(), titleX=T,titleY=T,margin=0.035,widths=c(0.375,0.425,0.2),which_layout=1) %>% partial_bundle()
```
### maf = 0.25
```{r}
pca=PCA_list$Prune_unfiltered$maf0.25[[1]]
data_pca=data.frame(INDIV=pca$sample.id,
PC1=pca$eigenvect[,1],
PC2=pca$eigenvect[,2],
PC3=pca$eigenvect[,3],
PC4=pca$eigenvect[,4],
LOCA=c(rep("Algarve",5),
rep("Bay of Biscay",11),
rep("Gulf of Lion",5),
rep("Costa Calida",5)))
color_med_atl=rev(brewer.pal(n=4,name="RdBu"))
p<-ggplot(data=data_pca,aes(x=PC1,y=PC2,label=INDIV))+
theme_minimal()+
theme(panel.grid=element_blank(),
panel.border=element_rect(fill="transparent"),
plot.title=element_text(hjust=0.5))+
geom_hline(yintercept=0,lty=2)+
geom_vline(xintercept=0,lty=2)+
geom_point(size=3,aes(col=LOCA))+
xlab(paste("PCA 1 (",round(pca$varprop[1]*100,2),"% )",sep=""))+
ylab(paste("PCA 2 (",round(pca$varprop[2]*100,2),"% )",sep=""))+
scale_colour_manual(name="Location",
values=c(color_med_atl[2],
color_med_atl[1],
color_med_atl[3],
color_med_atl[4]))
p1<-p
p<-ggplot(data=data_pca,aes(x=PC3,y=PC4,label=INDIV))+
theme_minimal()+
theme(panel.grid=element_blank(),
panel.border=element_rect(fill="transparent"),
plot.title=element_text(hjust=0.5))+
geom_hline(yintercept=0,lty=2)+
geom_vline(xintercept=0,lty=2)+
geom_point(size=3,aes(col=LOCA))+
xlab(paste("PCA 3 (",round(pca$varprop[3]*100,2),"% )",sep=""))+
ylab(paste("PCA 4 (",round(pca$varprop[4]*100,2),"% )",sep=""))+
scale_colour_manual(name="Location",
values=c(color_med_atl[2],
color_med_atl[1],
color_med_atl[3],
color_med_atl[4]))
p2<-p
data_varpop=data.frame(PC=factor(paste("P",seq(1,10),sep=""),levels=paste("P",seq(1,10),sep="")),VAR=pca$varprop[1:10])
pp<-ggplot(data_varpop,aes(x=PC,y=VAR))+
geom_bar(stat='identity',fill="dodgerblue2",alpha=0.25)+
theme_classic()+
xlab("Principal Component")+
ylab("Variation explained (%)")
```
```{r}
subplot(ggplotly(p1)%>% layout(legend = list(orientation = "h", x = 0.2, y =-0.15)), ggplotly(p2)%>%hide_legend(), ggplotly(pp)%>%hide_legend(), titleX=T,titleY=T,margin=0.035,widths=c(0.375,0.425,0.2),which_layout=1) %>% partial_bundle()
```
### maf = 0.30
```{r}
pca=PCA_list$Prune_unfiltered$maf0.3[[1]]
data_pca=data.frame(INDIV=pca$sample.id,
PC1=pca$eigenvect[,1],
PC2=pca$eigenvect[,2],
PC3=pca$eigenvect[,3],
PC4=pca$eigenvect[,4],
LOCA=c(rep("Algarve",5),
rep("Bay of Biscay",11),
rep("Gulf of Lion",5),
rep("Costa Calida",5)))
color_med_atl=rev(brewer.pal(n=4,name="RdBu"))
p<-ggplot(data=data_pca,aes(x=PC1,y=PC2,label=INDIV))+
theme_minimal()+
theme(panel.grid=element_blank(),
panel.border=element_rect(fill="transparent"),
plot.title=element_text(hjust=0.5))+
geom_hline(yintercept=0,lty=2)+
geom_vline(xintercept=0,lty=2)+
geom_point(size=3,aes(col=LOCA))+
xlab(paste("PCA 1 (",round(pca$varprop[1]*100,2),"% )",sep=""))+
ylab(paste("PCA 2 (",round(pca$varprop[2]*100,2),"% )",sep=""))+
scale_colour_manual(name="Location",
values=c(color_med_atl[2],
color_med_atl[1],
color_med_atl[3],
color_med_atl[4]))
p1<-p
p<-ggplot(data=data_pca,aes(x=PC3,y=PC4,label=INDIV))+
theme_minimal()+
theme(panel.grid=element_blank(),
panel.border=element_rect(fill="transparent"),
plot.title=element_text(hjust=0.5))+
geom_hline(yintercept=0,lty=2)+
geom_vline(xintercept=0,lty=2)+
geom_point(size=3,aes(col=LOCA))+
xlab(paste("PCA 3 (",round(pca$varprop[3]*100,2),"% )",sep=""))+
ylab(paste("PCA 4 (",round(pca$varprop[4]*100,2),"% )",sep=""))+
scale_colour_manual(name="Location",
values=c(color_med_atl[2],
color_med_atl[1],
color_med_atl[3],
color_med_atl[4]))
p2<-p
data_varpop=data.frame(PC=factor(paste("P",seq(1,10),sep=""),levels=paste("P",seq(1,10),sep="")),VAR=pca$varprop[1:10])
pp<-ggplot(data_varpop,aes(x=PC,y=VAR))+
geom_bar(stat='identity',fill="dodgerblue2",alpha=0.25)+
theme_classic()+
xlab("Principal Component")+
ylab("Variation explained (%)")
```
```{r}
subplot(ggplotly(p1)%>% layout(legend = list(orientation = "h", x = 0.2, y =-0.15)), ggplotly(p2)%>%hide_legend(), ggplotly(pp)%>%hide_legend(), titleX=T,titleY=T,margin=0.035,widths=c(0.375,0.425,0.2),which_layout=1) %>% partial_bundle()
```
### maf = 0.35
```{r}
pca=PCA_list$Prune_unfiltered$maf0.35[[1]]
data_pca=data.frame(INDIV=pca$sample.id,
PC1=pca$eigenvect[,1],
PC2=pca$eigenvect[,2],
PC3=pca$eigenvect[,3],
PC4=pca$eigenvect[,4],
LOCA=c(rep("Algarve",5),
rep("Bay of Biscay",11),
rep("Gulf of Lion",5),
rep("Costa Calida",5)))
color_med_atl=rev(brewer.pal(n=4,name="RdBu"))
p<-ggplot(data=data_pca,aes(x=PC1,y=PC2,label=INDIV))+
theme_minimal()+
theme(panel.grid=element_blank(),
panel.border=element_rect(fill="transparent"),
plot.title=element_text(hjust=0.5))+
geom_hline(yintercept=0,lty=2)+
geom_vline(xintercept=0,lty=2)+
geom_point(size=3,aes(col=LOCA))+
xlab(paste("PCA 1 (",round(pca$varprop[1]*100,2),"% )",sep=""))+
ylab(paste("PCA 2 (",round(pca$varprop[2]*100,2),"% )",sep=""))+
scale_colour_manual(name="Location",
values=c(color_med_atl[2],
color_med_atl[1],
color_med_atl[3],
color_med_atl[4]))
p1<-p
p<-ggplot(data=data_pca,aes(x=PC3,y=PC4,label=INDIV))+
theme_minimal()+
theme(panel.grid=element_blank(),
panel.border=element_rect(fill="transparent"),
plot.title=element_text(hjust=0.5))+
geom_hline(yintercept=0,lty=2)+
geom_vline(xintercept=0,lty=2)+
geom_point(size=3,aes(col=LOCA))+
xlab(paste("PCA 3 (",round(pca$varprop[3]*100,2),"% )",sep=""))+
ylab(paste("PCA 4 (",round(pca$varprop[4]*100,2),"% )",sep=""))+
scale_colour_manual(name="Location",
values=c(color_med_atl[2],
color_med_atl[1],
color_med_atl[3],
color_med_atl[4]))
p2<-p
data_varpop=data.frame(PC=factor(paste("P",seq(1,10),sep=""),levels=paste("P",seq(1,10),sep="")),VAR=pca$varprop[1:10])
pp<-ggplot(data_varpop,aes(x=PC,y=VAR))+
geom_bar(stat='identity',fill="dodgerblue2",alpha=0.25)+
theme_classic()+
xlab("Principal Component")+
ylab("Variation explained (%)")
```
```{r}
subplot(ggplotly(p1)%>% layout(legend = list(orientation = "h", x = 0.2, y =-0.15)), ggplotly(p2)%>%hide_legend(), ggplotly(pp)%>%hide_legend(), titleX=T,titleY=T,margin=0.035,widths=c(0.375,0.425,0.2),which_layout=1) %>% partial_bundle()
```
### maf = 0.40
```{r}
pca=PCA_list$Prune_unfiltered$maf0.4[[1]]
data_pca=data.frame(INDIV=pca$sample.id,
PC1=pca$eigenvect[,1],
PC2=pca$eigenvect[,2],
PC3=pca$eigenvect[,3],
PC4=pca$eigenvect[,4],
LOCA=c(rep("Algarve",5),
rep("Bay of Biscay",11),
rep("Gulf of Lion",5),
rep("Costa Calida",5)))
color_med_atl=rev(brewer.pal(n=4,name="RdBu"))
p<-ggplot(data=data_pca,aes(x=PC1,y=PC2,label=INDIV))+
theme_minimal()+
theme(panel.grid=element_blank(),
panel.border=element_rect(fill="transparent"),
plot.title=element_text(hjust=0.5))+
geom_hline(yintercept=0,lty=2)+
geom_vline(xintercept=0,lty=2)+
geom_point(size=3,aes(col=LOCA))+
xlab(paste("PCA 1 (",round(pca$varprop[1]*100,2),"% )",sep=""))+
ylab(paste("PCA 2 (",round(pca$varprop[2]*100,2),"% )",sep=""))+
scale_colour_manual(name="Location",
values=c(color_med_atl[2],
color_med_atl[1],
color_med_atl[3],
color_med_atl[4]))
p1<-p
p<-ggplot(data=data_pca,aes(x=PC3,y=PC4,label=INDIV))+
theme_minimal()+
theme(panel.grid=element_blank(),
panel.border=element_rect(fill="transparent"),
plot.title=element_text(hjust=0.5))+
geom_hline(yintercept=0,lty=2)+
geom_vline(xintercept=0,lty=2)+
geom_point(size=3,aes(col=LOCA))+
xlab(paste("PCA 3 (",round(pca$varprop[3]*100,2),"% )",sep=""))+
ylab(paste("PCA 4 (",round(pca$varprop[4]*100,2),"% )",sep=""))+
scale_colour_manual(name="Location",
values=c(color_med_atl[2],
color_med_atl[1],
color_med_atl[3],
color_med_atl[4]))
p2<-p
data_varpop=data.frame(PC=factor(paste("P",seq(1,10),sep=""),levels=paste("P",seq(1,10),sep="")),VAR=pca$varprop[1:10])
pp<-ggplot(data_varpop,aes(x=PC,y=VAR))+
geom_bar(stat='identity',fill="dodgerblue2",alpha=0.25)+
theme_classic()+
xlab("Principal Component")+
ylab("Variation explained (%)")
```
```{r}
subplot(ggplotly(p1)%>% layout(legend = list(orientation = "h", x = 0.2, y =-0.15)), ggplotly(p2)%>%hide_legend(), ggplotly(pp)%>%hide_legend(), titleX=T,titleY=T,margin=0.035,widths=c(0.375,0.425,0.2),which_layout=1) %>% partial_bundle()
```
### maf = 0.45
```{r}
pca=PCA_list$Prune_unfiltered$maf0.45[[1]]
data_pca=data.frame(INDIV=pca$sample.id,
PC1=pca$eigenvect[,1],
PC2=pca$eigenvect[,2],
PC3=pca$eigenvect[,3],
PC4=pca$eigenvect[,4],
LOCA=c(rep("Algarve",5),
rep("Bay of Biscay",11),
rep("Gulf of Lion",5),
rep("Costa Calida",5)))
color_med_atl=rev(brewer.pal(n=4,name="RdBu"))
p<-ggplot(data=data_pca,aes(x=PC1,y=PC2,label=INDIV))+
theme_minimal()+
theme(panel.grid=element_blank(),
panel.border=element_rect(fill="transparent"),
plot.title=element_text(hjust=0.5))+
geom_hline(yintercept=0,lty=2)+
geom_vline(xintercept=0,lty=2)+
geom_point(size=3,aes(col=LOCA))+
xlab(paste("PCA 1 (",round(pca$varprop[1]*100,2),"% )",sep=""))+
ylab(paste("PCA 2 (",round(pca$varprop[2]*100,2),"% )",sep=""))+
scale_colour_manual(name="Location",
values=c(color_med_atl[2],
color_med_atl[1],
color_med_atl[3],
color_med_atl[4]))
p1<-p
p<-ggplot(data=data_pca,aes(x=PC3,y=PC4,label=INDIV))+
theme_minimal()+
theme(panel.grid=element_blank(),
panel.border=element_rect(fill="transparent"),
plot.title=element_text(hjust=0.5))+
geom_hline(yintercept=0,lty=2)+
geom_vline(xintercept=0,lty=2)+
geom_point(size=3,aes(col=LOCA))+
xlab(paste("PCA 3 (",round(pca$varprop[3]*100,2),"% )",sep=""))+
ylab(paste("PCA 4 (",round(pca$varprop[4]*100,2),"% )",sep=""))+
scale_colour_manual(name="Location",
values=c(color_med_atl[2],
color_med_atl[1],
color_med_atl[3],
color_med_atl[4]))
p2<-p
data_varpop=data.frame(PC=factor(paste("P",seq(1,10),sep=""),levels=paste("P",seq(1,10),sep="")),VAR=pca$varprop[1:10])
pp<-ggplot(data_varpop,aes(x=PC,y=VAR))+
geom_bar(stat='identity',fill="dodgerblue2",alpha=0.25)+
theme_classic()+
xlab("Principal Component")+
ylab("Variation explained (%)")
```
```{r}
subplot(ggplotly(p1)%>% layout(legend = list(orientation = "h", x = 0.2, y =-0.15)), ggplotly(p2)%>%hide_legend(), ggplotly(pp)%>%hide_legend(), titleX=T,titleY=T,margin=0.035,widths=c(0.375,0.425,0.2),which_layout=1) %>% partial_bundle()
```
### maf = 0.50
```{r}
pca=PCA_list$Prune_unfiltered$maf0.5[[1]]
data_pca=data.frame(INDIV=pca$sample.id,
PC1=pca$eigenvect[,1],
PC2=pca$eigenvect[,2],
PC3=pca$eigenvect[,3],
PC4=pca$eigenvect[,4],
LOCA=c(rep("Algarve",5),
rep("Bay of Biscay",11),
rep("Gulf of Lion",5),
rep("Costa Calida",5)))
color_med_atl=rev(brewer.pal(n=4,name="RdBu"))
p<-ggplot(data=data_pca,aes(x=PC1,y=PC2,label=INDIV))+
theme_minimal()+
theme(panel.grid=element_blank(),
panel.border=element_rect(fill="transparent"),
plot.title=element_text(hjust=0.5))+
geom_hline(yintercept=0,lty=2)+
geom_vline(xintercept=0,lty=2)+
geom_point(size=3,aes(col=LOCA))+
xlab(paste("PCA 1 (",round(pca$varprop[1]*100,2),"% )",sep=""))+
ylab(paste("PCA 2 (",round(pca$varprop[2]*100,2),"% )",sep=""))+
scale_colour_manual(name="Location",
values=c(color_med_atl[2],
color_med_atl[1],
color_med_atl[3],
color_med_atl[4]))
p1<-p
p<-ggplot(data=data_pca,aes(x=PC3,y=PC4,label=INDIV))+
theme_minimal()+
theme(panel.grid=element_blank(),
panel.border=element_rect(fill="transparent"),
plot.title=element_text(hjust=0.5))+
geom_hline(yintercept=0,lty=2)+
geom_vline(xintercept=0,lty=2)+
geom_point(size=3,aes(col=LOCA))+
xlab(paste("PCA 3 (",round(pca$varprop[3]*100,2),"% )",sep=""))+
ylab(paste("PCA 4 (",round(pca$varprop[4]*100,2),"% )",sep=""))+
scale_colour_manual(name="Location",
values=c(color_med_atl[2],
color_med_atl[1],
color_med_atl[3],
color_med_atl[4]))
p2<-p
data_varpop=data.frame(PC=factor(paste("P",seq(1,10),sep=""),levels=paste("P",seq(1,10),sep="")),VAR=pca$varprop[1:10])
pp<-ggplot(data_varpop,aes(x=PC,y=VAR))+
geom_bar(stat='identity',fill="dodgerblue2",alpha=0.25)+
theme_classic()+
xlab("Principal Component")+
ylab("Variation explained (%)")
```
```{r}
subplot(ggplotly(p1)%>% layout(legend = list(orientation = "h", x = 0.2, y =-0.15)), ggplotly(p2)%>%hide_legend(), ggplotly(pp)%>%hide_legend(), titleX=T,titleY=T,margin=0.035,widths=c(0.375,0.425,0.2),which_layout=1) %>% partial_bundle()
```
Merluccius merluccius {data-navmenu="Species"}
=======================================================================
```{r, include = FALSE}
load(file = paste(path,"/output/pca/Mmerl_PCA_list.Rdata",sep=""))
```
Row {.tabset data-height=100}
-----------------------
<center>
<font size="6">**Merluccius merluccius**</font>
</center>
Row {.tabset data-height=50}
-----------------------
<center>
<font size="6">**All filtered SNPS**</font>
</center>
Row {.tabset data-height=600}
-----------------------
### maf = 0
```{r}
pca=PCA_list$All_filtered$maf0[[1]]
data_pca=data.frame(INDIV=pca$sample.id,
PC1=pca$eigenvect[,1],
PC2=pca$eigenvect[,2],
PC3=pca$eigenvect[,3],
PC4=pca$eigenvect[,4],
LOCA=c(rep("Algarve",5),
rep("Bay of Biscay",5),
rep("Gulf of Lion",5),
rep("Costa Calida",5)))
color_med_atl=rev(brewer.pal(n=4,name="RdBu"))
p<-ggplot(data=data_pca,aes(x=PC1,y=PC2,label=INDIV))+
theme_minimal()+
theme(panel.grid=element_blank(),
panel.border=element_rect(fill="transparent"),
plot.title=element_text(hjust=0.5))+
geom_hline(yintercept=0,lty=2)+
geom_vline(xintercept=0,lty=2)+
geom_point(size=3,aes(col=LOCA))+
xlab(paste("PCA 1 (",round(pca$varprop[1]*100,2),"% )",sep=""))+
ylab(paste("PCA 2 (",round(pca$varprop[2]*100,2),"% )",sep=""))+
scale_colour_manual(name="Location",
values=c(color_med_atl[2],
color_med_atl[1],
color_med_atl[3],
color_med_atl[4]))
p1<-p
p<-ggplot(data=data_pca,aes(x=PC3,y=PC4,label=INDIV))+
theme_minimal()+
theme(panel.grid=element_blank(),
panel.border=element_rect(fill="transparent"),
plot.title=element_text(hjust=0.5))+
geom_hline(yintercept=0,lty=2)+
geom_vline(xintercept=0,lty=2)+
geom_point(size=3,aes(col=LOCA))+
xlab(paste("PCA 3 (",round(pca$varprop[3]*100,2),"% )",sep=""))+
ylab(paste("PCA 4 (",round(pca$varprop[4]*100,2),"% )",sep=""))+
scale_colour_manual(name="Location",
values=c(color_med_atl[2],
color_med_atl[1],
color_med_atl[3],
color_med_atl[4]))
p2<-p
data_varpop=data.frame(PC=factor(paste("P",seq(1,10),sep=""),levels=paste("P",seq(1,10),sep="")),VAR=pca$varprop[1:10])
pp<-ggplot(data_varpop,aes(x=PC,y=VAR))+
geom_bar(stat='identity',fill="dodgerblue2",alpha=0.25)+
theme_classic()+
xlab("Principal Component")+
ylab("Variation explained (%)")
```
```{r}
subplot(ggplotly(p1)%>% layout(legend = list(orientation = "h", x = 0.2, y =-0.15)), ggplotly(p2)%>%hide_legend(), ggplotly(pp)%>%hide_legend(), titleX=T,titleY=T,margin=0.035,widths=c(0.375,0.425,0.2),which_layout=1) %>% partial_bundle()
```
### maf = 0.05
```{r}
pca=PCA_list$All_filtered$maf0.05[[1]]
data_pca=data.frame(INDIV=pca$sample.id,
PC1=pca$eigenvect[,1],
PC2=pca$eigenvect[,2],
PC3=pca$eigenvect[,3],
PC4=pca$eigenvect[,4],
LOCA=c(rep("Algarve",5),
rep("Bay of Biscay",5),
rep("Gulf of Lion",5),
rep("Costa Calida",5)))
color_med_atl=rev(brewer.pal(n=4,name="RdBu"))
p<-ggplot(data=data_pca,aes(x=PC1,y=PC2,label=INDIV))+
theme_minimal()+
theme(panel.grid=element_blank(),
panel.border=element_rect(fill="transparent"),
plot.title=element_text(hjust=0.5))+
geom_hline(yintercept=0,lty=2)+
geom_vline(xintercept=0,lty=2)+
geom_point(size=3,aes(col=LOCA))+
xlab(paste("PCA 1 (",round(pca$varprop[1]*100,2),"% )",sep=""))+
ylab(paste("PCA 2 (",round(pca$varprop[2]*100,2),"% )",sep=""))+
scale_colour_manual(name="Location",
values=c(color_med_atl[2],
color_med_atl[1],
color_med_atl[3],
color_med_atl[4]))
p1<-p
p<-ggplot(data=data_pca,aes(x=PC3,y=PC4,label=INDIV))+
theme_minimal()+
theme(panel.grid=element_blank(),
panel.border=element_rect(fill="transparent"),
plot.title=element_text(hjust=0.5))+
geom_hline(yintercept=0,lty=2)+
geom_vline(xintercept=0,lty=2)+
geom_point(size=3,aes(col=LOCA))+
xlab(paste("PCA 3 (",round(pca$varprop[3]*100,2),"% )",sep=""))+
ylab(paste("PCA 4 (",round(pca$varprop[4]*100,2),"% )",sep=""))+
scale_colour_manual(name="Location",
values=c(color_med_atl[2],
color_med_atl[1],
color_med_atl[3],
color_med_atl[4]))
p2<-p
data_varpop=data.frame(PC=factor(paste("P",seq(1,10),sep=""),levels=paste("P",seq(1,10),sep="")),VAR=pca$varprop[1:10])
pp<-ggplot(data_varpop,aes(x=PC,y=VAR))+
geom_bar(stat='identity',fill="dodgerblue2",alpha=0.25)+
theme_classic()+
xlab("Principal Component")+
ylab("Variation explained (%)")
```
```{r}
subplot(ggplotly(p1)%>% layout(legend = list(orientation = "h", x = 0.2, y =-0.15)), ggplotly(p2)%>%hide_legend(), ggplotly(pp)%>%hide_legend(), titleX=T,titleY=T,margin=0.035,widths=c(0.375,0.425,0.2),which_layout=1) %>% partial_bundle()
```
### maf = 0.1
```{r}
pca=PCA_list$All_filtered$maf0.1[[1]]
data_pca=data.frame(INDIV=pca$sample.id,
PC1=pca$eigenvect[,1],
PC2=pca$eigenvect[,2],
PC3=pca$eigenvect[,3],
PC4=pca$eigenvect[,4],
LOCA=c(rep("Algarve",5),
rep("Bay of Biscay",5),
rep("Gulf of Lion",5),
rep("Costa Calida",5)))
color_med_atl=rev(brewer.pal(n=4,name="RdBu"))
p<-ggplot(data=data_pca,aes(x=PC1,y=PC2,label=INDIV))+
theme_minimal()+
theme(panel.grid=element_blank(),
panel.border=element_rect(fill="transparent"),
plot.title=element_text(hjust=0.5))+
geom_hline(yintercept=0,lty=2)+
geom_vline(xintercept=0,lty=2)+
geom_point(size=3,aes(col=LOCA))+
xlab(paste("PCA 1 (",round(pca$varprop[1]*100,2),"% )",sep=""))+
ylab(paste("PCA 2 (",round(pca$varprop[2]*100,2),"% )",sep=""))+
scale_colour_manual(name="Location",
values=c(color_med_atl[2],
color_med_atl[1],
color_med_atl[3],
color_med_atl[4]))
p1<-p
p<-ggplot(data=data_pca,aes(x=PC3,y=PC4,label=INDIV))+
theme_minimal()+
theme(panel.grid=element_blank(),
panel.border=element_rect(fill="transparent"),
plot.title=element_text(hjust=0.5))+
geom_hline(yintercept=0,lty=2)+
geom_vline(xintercept=0,lty=2)+
geom_point(size=3,aes(col=LOCA))+
xlab(paste("PCA 3 (",round(pca$varprop[3]*100,2),"% )",sep=""))+
ylab(paste("PCA 4 (",round(pca$varprop[4]*100,2),"% )",sep=""))+
scale_colour_manual(name="Location",
values=c(color_med_atl[2],
color_med_atl[1],
color_med_atl[3],
color_med_atl[4]))
p2<-p
data_varpop=data.frame(PC=factor(paste("P",seq(1,10),sep=""),levels=paste("P",seq(1,10),sep="")),VAR=pca$varprop[1:10])
pp<-ggplot(data_varpop,aes(x=PC,y=VAR))+
geom_bar(stat='identity',fill="dodgerblue2",alpha=0.25)+
theme_classic()+
xlab("Principal Component")+
ylab("Variation explained (%)")
```
```{r}
subplot(ggplotly(p1)%>% layout(legend = list(orientation = "h", x = 0.2, y =-0.15)), ggplotly(p2)%>%hide_legend(), ggplotly(pp)%>%hide_legend(), titleX=T,titleY=T,margin=0.035,widths=c(0.375,0.425,0.2),which_layout=1) %>% partial_bundle()
```
### maf = 0.15
```{r}
pca=PCA_list$All_filtered$maf0.15[[1]]
data_pca=data.frame(INDIV=pca$sample.id,
PC1=pca$eigenvect[,1],
PC2=pca$eigenvect[,2],
PC3=pca$eigenvect[,3],
PC4=pca$eigenvect[,4],
LOCA=c(rep("Algarve",5),
rep("Bay of Biscay",5),
rep("Gulf of Lion",5),
rep("Costa Calida",5)))
color_med_atl=rev(brewer.pal(n=4,name="RdBu"))
p<-ggplot(data=data_pca,aes(x=PC1,y=PC2,label=INDIV))+
theme_minimal()+
theme(panel.grid=element_blank(),
panel.border=element_rect(fill="transparent"),
plot.title=element_text(hjust=0.5))+
geom_hline(yintercept=0,lty=2)+
geom_vline(xintercept=0,lty=2)+
geom_point(size=3,aes(col=LOCA))+
xlab(paste("PCA 1 (",round(pca$varprop[1]*100,2),"% )",sep=""))+
ylab(paste("PCA 2 (",round(pca$varprop[2]*100,2),"% )",sep=""))+
scale_colour_manual(name="Location",
values=c(color_med_atl[2],
color_med_atl[1],
color_med_atl[3],
color_med_atl[4]))
p1<-p
p<-ggplot(data=data_pca,aes(x=PC3,y=PC4,label=INDIV))+
theme_minimal()+
theme(panel.grid=element_blank(),
panel.border=element_rect(fill="transparent"),
plot.title=element_text(hjust=0.5))+
geom_hline(yintercept=0,lty=2)+
geom_vline(xintercept=0,lty=2)+
geom_point(size=3,aes(col=LOCA))+
xlab(paste("PCA 3 (",round(pca$varprop[3]*100,2),"% )",sep=""))+
ylab(paste("PCA 4 (",round(pca$varprop[4]*100,2),"% )",sep=""))+
scale_colour_manual(name="Location",
values=c(color_med_atl[2],
color_med_atl[1],
color_med_atl[3],
color_med_atl[4]))
p2<-p
data_varpop=data.frame(PC=factor(paste("P",seq(1,10),sep=""),levels=paste("P",seq(1,10),sep="")),VAR=pca$varprop[1:10])
pp<-ggplot(data_varpop,aes(x=PC,y=VAR))+
geom_bar(stat='identity',fill="dodgerblue2",alpha=0.25)+
theme_classic()+
xlab("Principal Component")+
ylab("Variation explained (%)")
```
```{r}
subplot(ggplotly(p1)%>% layout(legend = list(orientation = "h", x = 0.2, y =-0.15)), ggplotly(p2)%>%hide_legend(), ggplotly(pp)%>%hide_legend(), titleX=T,titleY=T,margin=0.035,widths=c(0.375,0.425,0.2),which_layout=1) %>% partial_bundle()
```
### maf = 0.20
```{r}
pca=PCA_list$All_filtered$maf0.2[[1]]
data_pca=data.frame(INDIV=pca$sample.id,
PC1=pca$eigenvect[,1],
PC2=pca$eigenvect[,2],
PC3=pca$eigenvect[,3],
PC4=pca$eigenvect[,4],
LOCA=c(rep("Algarve",5),
rep("Bay of Biscay",5),
rep("Gulf of Lion",5),
rep("Costa Calida",5)))
color_med_atl=rev(brewer.pal(n=4,name="RdBu"))
p<-ggplot(data=data_pca,aes(x=PC1,y=PC2,label=INDIV))+
theme_minimal()+
theme(panel.grid=element_blank(),
panel.border=element_rect(fill="transparent"),
plot.title=element_text(hjust=0.5))+
geom_hline(yintercept=0,lty=2)+
geom_vline(xintercept=0,lty=2)+
geom_point(size=3,aes(col=LOCA))+
xlab(paste("PCA 1 (",round(pca$varprop[1]*100,2),"% )",sep=""))+
ylab(paste("PCA 2 (",round(pca$varprop[2]*100,2),"% )",sep=""))+
scale_colour_manual(name="Location",
values=c(color_med_atl[2],
color_med_atl[1],
color_med_atl[3],
color_med_atl[4]))
p1<-p
p<-ggplot(data=data_pca,aes(x=PC3,y=PC4,label=INDIV))+
theme_minimal()+
theme(panel.grid=element_blank(),
panel.border=element_rect(fill="transparent"),
plot.title=element_text(hjust=0.5))+
geom_hline(yintercept=0,lty=2)+
geom_vline(xintercept=0,lty=2)+
geom_point(size=3,aes(col=LOCA))+
xlab(paste("PCA 3 (",round(pca$varprop[3]*100,2),"% )",sep=""))+
ylab(paste("PCA 4 (",round(pca$varprop[4]*100,2),"% )",sep=""))+
scale_colour_manual(name="Location",
values=c(color_med_atl[2],
color_med_atl[1],
color_med_atl[3],
color_med_atl[4]))
p2<-p
data_varpop=data.frame(PC=factor(paste("P",seq(1,10),sep=""),levels=paste("P",seq(1,10),sep="")),VAR=pca$varprop[1:10])
pp<-ggplot(data_varpop,aes(x=PC,y=VAR))+
geom_bar(stat='identity',fill="dodgerblue2",alpha=0.25)+
theme_classic()+
xlab("Principal Component")+
ylab("Variation explained (%)")
```
```{r}
subplot(ggplotly(p1)%>% layout(legend = list(orientation = "h", x = 0.2, y =-0.15)), ggplotly(p2)%>%hide_legend(), ggplotly(pp)%>%hide_legend(), titleX=T,titleY=T,margin=0.035,widths=c(0.375,0.425,0.2),which_layout=1) %>% partial_bundle()
```
### maf = 0.25
```{r}
pca=PCA_list$All_filtered$maf0.25[[1]]
data_pca=data.frame(INDIV=pca$sample.id,
PC1=pca$eigenvect[,1],
PC2=pca$eigenvect[,2],
PC3=pca$eigenvect[,3],
PC4=pca$eigenvect[,4],
LOCA=c(rep("Algarve",5),
rep("Bay of Biscay",5),
rep("Gulf of Lion",5),
rep("Costa Calida",5)))
color_med_atl=rev(brewer.pal(n=4,name="RdBu"))
p<-ggplot(data=data_pca,aes(x=PC1,y=PC2,label=INDIV))+
theme_minimal()+
theme(panel.grid=element_blank(),
panel.border=element_rect(fill="transparent"),
plot.title=element_text(hjust=0.5))+
geom_hline(yintercept=0,lty=2)+
geom_vline(xintercept=0,lty=2)+
geom_point(size=3,aes(col=LOCA))+
xlab(paste("PCA 1 (",round(pca$varprop[1]*100,2),"% )",sep=""))+
ylab(paste("PCA 2 (",round(pca$varprop[2]*100,2),"% )",sep=""))+
scale_colour_manual(name="Location",
values=c(color_med_atl[2],
color_med_atl[1],
color_med_atl[3],
color_med_atl[4]))
p1<-p
p<-ggplot(data=data_pca,aes(x=PC3,y=PC4,label=INDIV))+
theme_minimal()+
theme(panel.grid=element_blank(),
panel.border=element_rect(fill="transparent"),
plot.title=element_text(hjust=0.5))+
geom_hline(yintercept=0,lty=2)+
geom_vline(xintercept=0,lty=2)+
geom_point(size=3,aes(col=LOCA))+
xlab(paste("PCA 3 (",round(pca$varprop[3]*100,2),"% )",sep=""))+
ylab(paste("PCA 4 (",round(pca$varprop[4]*100,2),"% )",sep=""))+
scale_colour_manual(name="Location",
values=c(color_med_atl[2],
color_med_atl[1],
color_med_atl[3],
color_med_atl[4]))
p2<-p
data_varpop=data.frame(PC=factor(paste("P",seq(1,10),sep=""),levels=paste("P",seq(1,10),sep="")),VAR=pca$varprop[1:10])
pp<-ggplot(data_varpop,aes(x=PC,y=VAR))+
geom_bar(stat='identity',fill="dodgerblue2",alpha=0.25)+
theme_classic()+
xlab("Principal Component")+
ylab("Variation explained (%)")
```
```{r}
subplot(ggplotly(p1)%>% layout(legend = list(orientation = "h", x = 0.2, y =-0.15)), ggplotly(p2)%>%hide_legend(), ggplotly(pp)%>%hide_legend(), titleX=T,titleY=T,margin=0.035,widths=c(0.375,0.425,0.2),which_layout=1) %>% partial_bundle()
```
### maf = 0.30
```{r}
pca=PCA_list$All_filtered$maf0.3[[1]]
data_pca=data.frame(INDIV=pca$sample.id,
PC1=pca$eigenvect[,1],
PC2=pca$eigenvect[,2],
PC3=pca$eigenvect[,3],
PC4=pca$eigenvect[,4],
LOCA=c(rep("Algarve",5),
rep("Bay of Biscay",5),
rep("Gulf of Lion",5),
rep("Costa Calida",5)))
color_med_atl=rev(brewer.pal(n=4,name="RdBu"))
p<-ggplot(data=data_pca,aes(x=PC1,y=PC2,label=INDIV))+
theme_minimal()+
theme(panel.grid=element_blank(),
panel.border=element_rect(fill="transparent"),
plot.title=element_text(hjust=0.5))+
geom_hline(yintercept=0,lty=2)+
geom_vline(xintercept=0,lty=2)+
geom_point(size=3,aes(col=LOCA))+
xlab(paste("PCA 1 (",round(pca$varprop[1]*100,2),"% )",sep=""))+
ylab(paste("PCA 2 (",round(pca$varprop[2]*100,2),"% )",sep=""))+
scale_colour_manual(name="Location",
values=c(color_med_atl[2],
color_med_atl[1],
color_med_atl[3],
color_med_atl[4]))
p1<-p
p<-ggplot(data=data_pca,aes(x=PC3,y=PC4,label=INDIV))+
theme_minimal()+
theme(panel.grid=element_blank(),
panel.border=element_rect(fill="transparent"),
plot.title=element_text(hjust=0.5))+
geom_hline(yintercept=0,lty=2)+
geom_vline(xintercept=0,lty=2)+
geom_point(size=3,aes(col=LOCA))+
xlab(paste("PCA 3 (",round(pca$varprop[3]*100,2),"% )",sep=""))+
ylab(paste("PCA 4 (",round(pca$varprop[4]*100,2),"% )",sep=""))+
scale_colour_manual(name="Location",
values=c(color_med_atl[2],
color_med_atl[1],
color_med_atl[3],
color_med_atl[4]))
p2<-p
data_varpop=data.frame(PC=factor(paste("P",seq(1,10),sep=""),levels=paste("P",seq(1,10),sep="")),VAR=pca$varprop[1:10])
pp<-ggplot(data_varpop,aes(x=PC,y=VAR))+
geom_bar(stat='identity',fill="dodgerblue2",alpha=0.25)+
theme_classic()+
xlab("Principal Component")+
ylab("Variation explained (%)")
```
```{r}
subplot(ggplotly(p1)%>% layout(legend = list(orientation = "h", x = 0.2, y =-0.15)), ggplotly(p2)%>%hide_legend(), ggplotly(pp)%>%hide_legend(), titleX=T,titleY=T,margin=0.035,widths=c(0.375,0.425,0.2),which_layout=1) %>% partial_bundle()
```
### maf = 0.35
```{r}
pca=PCA_list$All_filtered$maf0.35[[1]]
data_pca=data.frame(INDIV=pca$sample.id,
PC1=pca$eigenvect[,1],
PC2=pca$eigenvect[,2],
PC3=pca$eigenvect[,3],
PC4=pca$eigenvect[,4],
LOCA=c(rep("Algarve",5),
rep("Bay of Biscay",5),
rep("Gulf of Lion",5),
rep("Costa Calida",5)))
color_med_atl=rev(brewer.pal(n=4,name="RdBu"))
p<-ggplot(data=data_pca,aes(x=PC1,y=PC2,label=INDIV))+
theme_minimal()+
theme(panel.grid=element_blank(),
panel.border=element_rect(fill="transparent"),
plot.title=element_text(hjust=0.5))+
geom_hline(yintercept=0,lty=2)+
geom_vline(xintercept=0,lty=2)+
geom_point(size=3,aes(col=LOCA))+
xlab(paste("PCA 1 (",round(pca$varprop[1]*100,2),"% )",sep=""))+
ylab(paste("PCA 2 (",round(pca$varprop[2]*100,2),"% )",sep=""))+
scale_colour_manual(name="Location",
values=c(color_med_atl[2],
color_med_atl[1],
color_med_atl[3],
color_med_atl[4]))
p1<-p
p<-ggplot(data=data_pca,aes(x=PC3,y=PC4,label=INDIV))+
theme_minimal()+
theme(panel.grid=element_blank(),
panel.border=element_rect(fill="transparent"),
plot.title=element_text(hjust=0.5))+
geom_hline(yintercept=0,lty=2)+
geom_vline(xintercept=0,lty=2)+
geom_point(size=3,aes(col=LOCA))+
xlab(paste("PCA 3 (",round(pca$varprop[3]*100,2),"% )",sep=""))+
ylab(paste("PCA 4 (",round(pca$varprop[4]*100,2),"% )",sep=""))+
scale_colour_manual(name="Location",
values=c(color_med_atl[2],
color_med_atl[1],
color_med_atl[3],
color_med_atl[4]))
p2<-p
data_varpop=data.frame(PC=factor(paste("P",seq(1,10),sep=""),levels=paste("P",seq(1,10),sep="")),VAR=pca$varprop[1:10])
pp<-ggplot(data_varpop,aes(x=PC,y=VAR))+
geom_bar(stat='identity',fill="dodgerblue2",alpha=0.25)+
theme_classic()+
xlab("Principal Component")+
ylab("Variation explained (%)")
```
```{r}
subplot(ggplotly(p1)%>% layout(legend = list(orientation = "h", x = 0.2, y =-0.15)), ggplotly(p2)%>%hide_legend(), ggplotly(pp)%>%hide_legend(), titleX=T,titleY=T,margin=0.035,widths=c(0.375,0.425,0.2),which_layout=1) %>% partial_bundle()
```
### maf = 0.40
```{r}
pca=PCA_list$All_filtered$maf0.4[[1]]
data_pca=data.frame(INDIV=pca$sample.id,
PC1=pca$eigenvect[,1],
PC2=pca$eigenvect[,2],
PC3=pca$eigenvect[,3],
PC4=pca$eigenvect[,4],
LOCA=c(rep("Algarve",5),
rep("Bay of Biscay",5),
rep("Gulf of Lion",5),
rep("Costa Calida",5)))
color_med_atl=rev(brewer.pal(n=4,name="RdBu"))
p<-ggplot(data=data_pca,aes(x=PC1,y=PC2,label=INDIV))+
theme_minimal()+
theme(panel.grid=element_blank(),
panel.border=element_rect(fill="transparent"),
plot.title=element_text(hjust=0.5))+
geom_hline(yintercept=0,lty=2)+
geom_vline(xintercept=0,lty=2)+
geom_point(size=3,aes(col=LOCA))+
xlab(paste("PCA 1 (",round(pca$varprop[1]*100,2),"% )",sep=""))+
ylab(paste("PCA 2 (",round(pca$varprop[2]*100,2),"% )",sep=""))+
scale_colour_manual(name="Location",
values=c(color_med_atl[2],
color_med_atl[1],
color_med_atl[3],
color_med_atl[4]))
p1<-p
p<-ggplot(data=data_pca,aes(x=PC3,y=PC4,label=INDIV))+
theme_minimal()+
theme(panel.grid=element_blank(),
panel.border=element_rect(fill="transparent"),
plot.title=element_text(hjust=0.5))+
geom_hline(yintercept=0,lty=2)+
geom_vline(xintercept=0,lty=2)+
geom_point(size=3,aes(col=LOCA))+
xlab(paste("PCA 3 (",round(pca$varprop[3]*100,2),"% )",sep=""))+
ylab(paste("PCA 4 (",round(pca$varprop[4]*100,2),"% )",sep=""))+
scale_colour_manual(name="Location",
values=c(color_med_atl[2],
color_med_atl[1],
color_med_atl[3],
color_med_atl[4]))
p2<-p
data_varpop=data.frame(PC=factor(paste("P",seq(1,10),sep=""),levels=paste("P",seq(1,10),sep="")),VAR=pca$varprop[1:10])
pp<-ggplot(data_varpop,aes(x=PC,y=VAR))+
geom_bar(stat='identity',fill="dodgerblue2",alpha=0.25)+
theme_classic()+
xlab("Principal Component")+
ylab("Variation explained (%)")
```
```{r}
subplot(ggplotly(p1)%>% layout(legend = list(orientation = "h", x = 0.2, y =-0.15)), ggplotly(p2)%>%hide_legend(), ggplotly(pp)%>%hide_legend(), titleX=T,titleY=T,margin=0.035,widths=c(0.375,0.425,0.2),which_layout=1) %>% partial_bundle()
```
### maf = 0.45
```{r}
pca=PCA_list$All_filtered$maf0.45[[1]]
data_pca=data.frame(INDIV=pca$sample.id,
PC1=pca$eigenvect[,1],
PC2=pca$eigenvect[,2],
PC3=pca$eigenvect[,3],
PC4=pca$eigenvect[,4],
LOCA=c(rep("Algarve",5),
rep("Bay of Biscay",5),
rep("Gulf of Lion",5),
rep("Costa Calida",5)))
color_med_atl=rev(brewer.pal(n=4,name="RdBu"))
p<-ggplot(data=data_pca,aes(x=PC1,y=PC2,label=INDIV))+
theme_minimal()+
theme(panel.grid=element_blank(),
panel.border=element_rect(fill="transparent"),
plot.title=element_text(hjust=0.5))+
geom_hline(yintercept=0,lty=2)+
geom_vline(xintercept=0,lty=2)+
geom_point(size=3,aes(col=LOCA))+
xlab(paste("PCA 1 (",round(pca$varprop[1]*100,2),"% )",sep=""))+
ylab(paste("PCA 2 (",round(pca$varprop[2]*100,2),"% )",sep=""))+
scale_colour_manual(name="Location",
values=c(color_med_atl[2],
color_med_atl[1],
color_med_atl[3],
color_med_atl[4]))
p1<-p
p<-ggplot(data=data_pca,aes(x=PC3,y=PC4,label=INDIV))+
theme_minimal()+
theme(panel.grid=element_blank(),
panel.border=element_rect(fill="transparent"),
plot.title=element_text(hjust=0.5))+
geom_hline(yintercept=0,lty=2)+
geom_vline(xintercept=0,lty=2)+
geom_point(size=3,aes(col=LOCA))+
xlab(paste("PCA 3 (",round(pca$varprop[3]*100,2),"% )",sep=""))+
ylab(paste("PCA 4 (",round(pca$varprop[4]*100,2),"% )",sep=""))+
scale_colour_manual(name="Location",
values=c(color_med_atl[2],
color_med_atl[1],
color_med_atl[3],
color_med_atl[4]))
p2<-p
data_varpop=data.frame(PC=factor(paste("P",seq(1,10),sep=""),levels=paste("P",seq(1,10),sep="")),VAR=pca$varprop[1:10])
pp<-ggplot(data_varpop,aes(x=PC,y=VAR))+
geom_bar(stat='identity',fill="dodgerblue2",alpha=0.25)+
theme_classic()+
xlab("Principal Component")+
ylab("Variation explained (%)")
```
```{r}
subplot(ggplotly(p1)%>% layout(legend = list(orientation = "h", x = 0.2, y =-0.15)), ggplotly(p2)%>%hide_legend(), ggplotly(pp)%>%hide_legend(), titleX=T,titleY=T,margin=0.035,widths=c(0.375,0.425,0.2),which_layout=1) %>% partial_bundle()
```
### maf = 0.50
```{r}
pca=PCA_list$All_filtered$maf0.5[[1]]
data_pca=data.frame(INDIV=pca$sample.id,
PC1=pca$eigenvect[,1],
PC2=pca$eigenvect[,2],
PC3=pca$eigenvect[,3],
PC4=pca$eigenvect[,4],
LOCA=c(rep("Algarve",5),
rep("Bay of Biscay",5),
rep("Gulf of Lion",5),
rep("Costa Calida",5)))
color_med_atl=rev(brewer.pal(n=4,name="RdBu"))
p<-ggplot(data=data_pca,aes(x=PC1,y=PC2,label=INDIV))+
theme_minimal()+
theme(panel.grid=element_blank(),
panel.border=element_rect(fill="transparent"),
plot.title=element_text(hjust=0.5))+
geom_hline(yintercept=0,lty=2)+
geom_vline(xintercept=0,lty=2)+
geom_point(size=3,aes(col=LOCA))+
xlab(paste("PCA 1 (",round(pca$varprop[1]*100,2),"% )",sep=""))+
ylab(paste("PCA 2 (",round(pca$varprop[2]*100,2),"% )",sep=""))+
scale_colour_manual(name="Location",
values=c(color_med_atl[2],
color_med_atl[1],
color_med_atl[3],
color_med_atl[4]))
p1<-p
p<-ggplot(data=data_pca,aes(x=PC3,y=PC4,label=INDIV))+
theme_minimal()+
theme(panel.grid=element_blank(),
panel.border=element_rect(fill="transparent"),
plot.title=element_text(hjust=0.5))+
geom_hline(yintercept=0,lty=2)+
geom_vline(xintercept=0,lty=2)+
geom_point(size=3,aes(col=LOCA))+
xlab(paste("PCA 3 (",round(pca$varprop[3]*100,2),"% )",sep=""))+
ylab(paste("PCA 4 (",round(pca$varprop[4]*100,2),"% )",sep=""))+
scale_colour_manual(name="Location",
values=c(color_med_atl[2],
color_med_atl[1],
color_med_atl[3],
color_med_atl[4]))
p2<-p
data_varpop=data.frame(PC=factor(paste("P",seq(1,10),sep=""),levels=paste("P",seq(1,10),sep="")),VAR=pca$varprop[1:10])
pp<-ggplot(data_varpop,aes(x=PC,y=VAR))+
geom_bar(stat='identity',fill="dodgerblue2",alpha=0.25)+
theme_classic()+
xlab("Principal Component")+
ylab("Variation explained (%)")
```
```{r}
subplot(ggplotly(p1)%>% layout(legend = list(orientation = "h", x = 0.2, y =-0.15)), ggplotly(p2)%>%hide_legend(), ggplotly(pp)%>%hide_legend(), titleX=T,titleY=T,margin=0.035,widths=c(0.375,0.425,0.2),which_layout=1) %>% partial_bundle()
```
Row {.tabset data-height=50}
-----------------------
<center>
<font size="6">**Pruned filtered SNPS**</font>
</center>
Row {.tabset data-height=600}
-----------------------
### maf = 0
```{r}
pca=PCA_list$Prune_filtered$maf0[[1]]
data_pca=data.frame(INDIV=pca$sample.id,
PC1=pca$eigenvect[,1],
PC2=pca$eigenvect[,2],
PC3=pca$eigenvect[,3],
PC4=pca$eigenvect[,4],
LOCA=c(rep("Algarve",5),
rep("Bay of Biscay",5),
rep("Gulf of Lion",5),
rep("Costa Calida",5)))
color_med_atl=rev(brewer.pal(n=4,name="RdBu"))
p<-ggplot(data=data_pca,aes(x=PC1,y=PC2,label=INDIV))+
theme_minimal()+
theme(panel.grid=element_blank(),
panel.border=element_rect(fill="transparent"),
plot.title=element_text(hjust=0.5))+
geom_hline(yintercept=0,lty=2)+
geom_vline(xintercept=0,lty=2)+
geom_point(size=3,aes(col=LOCA))+
xlab(paste("PCA 1 (",round(pca$varprop[1]*100,2),"% )",sep=""))+
ylab(paste("PCA 2 (",round(pca$varprop[2]*100,2),"% )",sep=""))+
scale_colour_manual(name="Location",
values=c(color_med_atl[2],
color_med_atl[1],
color_med_atl[3],
color_med_atl[4]))
p1<-p
p<-ggplot(data=data_pca,aes(x=PC3,y=PC4,label=INDIV))+
theme_minimal()+
theme(panel.grid=element_blank(),
panel.border=element_rect(fill="transparent"),
plot.title=element_text(hjust=0.5))+
geom_hline(yintercept=0,lty=2)+
geom_vline(xintercept=0,lty=2)+
geom_point(size=3,aes(col=LOCA))+
xlab(paste("PCA 3 (",round(pca$varprop[3]*100,2),"% )",sep=""))+
ylab(paste("PCA 4 (",round(pca$varprop[4]*100,2),"% )",sep=""))+
scale_colour_manual(name="Location",
values=c(color_med_atl[2],
color_med_atl[1],
color_med_atl[3],
color_med_atl[4]))
p2<-p
data_varpop=data.frame(PC=factor(paste("P",seq(1,10),sep=""),levels=paste("P",seq(1,10),sep="")),VAR=pca$varprop[1:10])
pp<-ggplot(data_varpop,aes(x=PC,y=VAR))+
geom_bar(stat='identity',fill="dodgerblue2",alpha=0.25)+
theme_classic()+
xlab("Principal Component")+
ylab("Variation explained (%)")
```
```{r}
subplot(ggplotly(p1)%>% layout(legend = list(orientation = "h", x = 0.2, y =-0.15)), ggplotly(p2)%>%hide_legend(), ggplotly(pp)%>%hide_legend(), titleX=T,titleY=T,margin=0.035,widths=c(0.375,0.425,0.2),which_layout=1) %>% partial_bundle()
```
### maf = 0.05
```{r}
pca=PCA_list$Prune_filtered$maf0.05[[1]]
data_pca=data.frame(INDIV=pca$sample.id,
PC1=pca$eigenvect[,1],
PC2=pca$eigenvect[,2],
PC3=pca$eigenvect[,3],
PC4=pca$eigenvect[,4],
LOCA=c(rep("Algarve",5),
rep("Bay of Biscay",5),
rep("Gulf of Lion",5),
rep("Costa Calida",5)))
color_med_atl=rev(brewer.pal(n=4,name="RdBu"))
p<-ggplot(data=data_pca,aes(x=PC1,y=PC2,label=INDIV))+
theme_minimal()+
theme(panel.grid=element_blank(),
panel.border=element_rect(fill="transparent"),
plot.title=element_text(hjust=0.5))+
geom_hline(yintercept=0,lty=2)+
geom_vline(xintercept=0,lty=2)+
geom_point(size=3,aes(col=LOCA))+
xlab(paste("PCA 1 (",round(pca$varprop[1]*100,2),"% )",sep=""))+
ylab(paste("PCA 2 (",round(pca$varprop[2]*100,2),"% )",sep=""))+
scale_colour_manual(name="Location",
values=c(color_med_atl[2],
color_med_atl[1],
color_med_atl[3],
color_med_atl[4]))
p1<-p
p<-ggplot(data=data_pca,aes(x=PC3,y=PC4,label=INDIV))+
theme_minimal()+
theme(panel.grid=element_blank(),
panel.border=element_rect(fill="transparent"),
plot.title=element_text(hjust=0.5))+
geom_hline(yintercept=0,lty=2)+
geom_vline(xintercept=0,lty=2)+
geom_point(size=3,aes(col=LOCA))+
xlab(paste("PCA 3 (",round(pca$varprop[3]*100,2),"% )",sep=""))+
ylab(paste("PCA 4 (",round(pca$varprop[4]*100,2),"% )",sep=""))+
scale_colour_manual(name="Location",
values=c(color_med_atl[2],
color_med_atl[1],
color_med_atl[3],
color_med_atl[4]))
p2<-p
data_varpop=data.frame(PC=factor(paste("P",seq(1,10),sep=""),levels=paste("P",seq(1,10),sep="")),VAR=pca$varprop[1:10])
pp<-ggplot(data_varpop,aes(x=PC,y=VAR))+
geom_bar(stat='identity',fill="dodgerblue2",alpha=0.25)+
theme_classic()+
xlab("Principal Component")+
ylab("Variation explained (%)")
```
```{r}
subplot(ggplotly(p1)%>% layout(legend = list(orientation = "h", x = 0.2, y =-0.15)), ggplotly(p2)%>%hide_legend(), ggplotly(pp)%>%hide_legend(), titleX=T,titleY=T,margin=0.035,widths=c(0.375,0.425,0.2),which_layout=1) %>% partial_bundle()
```
### maf = 0.1
```{r}
pca=PCA_list$Prune_filtered$maf0.1[[1]]
data_pca=data.frame(INDIV=pca$sample.id,
PC1=pca$eigenvect[,1],
PC2=pca$eigenvect[,2],
PC3=pca$eigenvect[,3],
PC4=pca$eigenvect[,4],
LOCA=c(rep("Algarve",5),
rep("Bay of Biscay",5),
rep("Gulf of Lion",5),
rep("Costa Calida",5)))
color_med_atl=rev(brewer.pal(n=4,name="RdBu"))
p<-ggplot(data=data_pca,aes(x=PC1,y=PC2,label=INDIV))+
theme_minimal()+
theme(panel.grid=element_blank(),
panel.border=element_rect(fill="transparent"),
plot.title=element_text(hjust=0.5))+
geom_hline(yintercept=0,lty=2)+
geom_vline(xintercept=0,lty=2)+
geom_point(size=3,aes(col=LOCA))+
xlab(paste("PCA 1 (",round(pca$varprop[1]*100,2),"% )",sep=""))+
ylab(paste("PCA 2 (",round(pca$varprop[2]*100,2),"% )",sep=""))+
scale_colour_manual(name="Location",
values=c(color_med_atl[2],
color_med_atl[1],
color_med_atl[3],
color_med_atl[4]))
p1<-p
p<-ggplot(data=data_pca,aes(x=PC3,y=PC4,label=INDIV))+
theme_minimal()+
theme(panel.grid=element_blank(),
panel.border=element_rect(fill="transparent"),
plot.title=element_text(hjust=0.5))+
geom_hline(yintercept=0,lty=2)+
geom_vline(xintercept=0,lty=2)+
geom_point(size=3,aes(col=LOCA))+
xlab(paste("PCA 3 (",round(pca$varprop[3]*100,2),"% )",sep=""))+
ylab(paste("PCA 4 (",round(pca$varprop[4]*100,2),"% )",sep=""))+
scale_colour_manual(name="Location",
values=c(color_med_atl[2],
color_med_atl[1],
color_med_atl[3],
color_med_atl[4]))
p2<-p
data_varpop=data.frame(PC=factor(paste("P",seq(1,10),sep=""),levels=paste("P",seq(1,10),sep="")),VAR=pca$varprop[1:10])
pp<-ggplot(data_varpop,aes(x=PC,y=VAR))+
geom_bar(stat='identity',fill="dodgerblue2",alpha=0.25)+
theme_classic()+
xlab("Principal Component")+
ylab("Variation explained (%)")
```
```{r}
subplot(ggplotly(p1)%>% layout(legend = list(orientation = "h", x = 0.2, y =-0.15)), ggplotly(p2)%>%hide_legend(), ggplotly(pp)%>%hide_legend(), titleX=T,titleY=T,margin=0.035,widths=c(0.375,0.425,0.2),which_layout=1) %>% partial_bundle()
```
### maf = 0.15
```{r}
pca=PCA_list$Prune_filtered$maf0.15[[1]]
data_pca=data.frame(INDIV=pca$sample.id,
PC1=pca$eigenvect[,1],
PC2=pca$eigenvect[,2],
PC3=pca$eigenvect[,3],
PC4=pca$eigenvect[,4],
LOCA=c(rep("Algarve",5),
rep("Bay of Biscay",5),
rep("Gulf of Lion",5),
rep("Costa Calida",5)))
color_med_atl=rev(brewer.pal(n=4,name="RdBu"))
p<-ggplot(data=data_pca,aes(x=PC1,y=PC2,label=INDIV))+
theme_minimal()+
theme(panel.grid=element_blank(),
panel.border=element_rect(fill="transparent"),
plot.title=element_text(hjust=0.5))+
geom_hline(yintercept=0,lty=2)+
geom_vline(xintercept=0,lty=2)+
geom_point(size=3,aes(col=LOCA))+
xlab(paste("PCA 1 (",round(pca$varprop[1]*100,2),"% )",sep=""))+
ylab(paste("PCA 2 (",round(pca$varprop[2]*100,2),"% )",sep=""))+
scale_colour_manual(name="Location",
values=c(color_med_atl[2],
color_med_atl[1],
color_med_atl[3],
color_med_atl[4]))
p1<-p
p<-ggplot(data=data_pca,aes(x=PC3,y=PC4,label=INDIV))+
theme_minimal()+
theme(panel.grid=element_blank(),
panel.border=element_rect(fill="transparent"),
plot.title=element_text(hjust=0.5))+
geom_hline(yintercept=0,lty=2)+
geom_vline(xintercept=0,lty=2)+
geom_point(size=3,aes(col=LOCA))+
xlab(paste("PCA 3 (",round(pca$varprop[3]*100,2),"% )",sep=""))+
ylab(paste("PCA 4 (",round(pca$varprop[4]*100,2),"% )",sep=""))+
scale_colour_manual(name="Location",
values=c(color_med_atl[2],
color_med_atl[1],
color_med_atl[3],
color_med_atl[4]))
p2<-p
data_varpop=data.frame(PC=factor(paste("P",seq(1,10),sep=""),levels=paste("P",seq(1,10),sep="")),VAR=pca$varprop[1:10])
pp<-ggplot(data_varpop,aes(x=PC,y=VAR))+
geom_bar(stat='identity',fill="dodgerblue2",alpha=0.25)+
theme_classic()+
xlab("Principal Component")+
ylab("Variation explained (%)")
```
```{r}
subplot(ggplotly(p1)%>% layout(legend = list(orientation = "h", x = 0.2, y =-0.15)), ggplotly(p2)%>%hide_legend(), ggplotly(pp)%>%hide_legend(), titleX=T,titleY=T,margin=0.035,widths=c(0.375,0.425,0.2),which_layout=1) %>% partial_bundle()
```
### maf = 0.20
```{r}
pca=PCA_list$Prune_filtered$maf0.2[[1]]
data_pca=data.frame(INDIV=pca$sample.id,
PC1=pca$eigenvect[,1],
PC2=pca$eigenvect[,2],
PC3=pca$eigenvect[,3],
PC4=pca$eigenvect[,4],
LOCA=c(rep("Algarve",5),
rep("Bay of Biscay",5),
rep("Gulf of Lion",5),
rep("Costa Calida",5)))
color_med_atl=rev(brewer.pal(n=4,name="RdBu"))
p<-ggplot(data=data_pca,aes(x=PC1,y=PC2,label=INDIV))+
theme_minimal()+
theme(panel.grid=element_blank(),
panel.border=element_rect(fill="transparent"),
plot.title=element_text(hjust=0.5))+
geom_hline(yintercept=0,lty=2)+
geom_vline(xintercept=0,lty=2)+
geom_point(size=3,aes(col=LOCA))+
xlab(paste("PCA 1 (",round(pca$varprop[1]*100,2),"% )",sep=""))+
ylab(paste("PCA 2 (",round(pca$varprop[2]*100,2),"% )",sep=""))+
scale_colour_manual(name="Location",
values=c(color_med_atl[2],
color_med_atl[1],
color_med_atl[3],
color_med_atl[4]))
p1<-p
p<-ggplot(data=data_pca,aes(x=PC3,y=PC4,label=INDIV))+
theme_minimal()+
theme(panel.grid=element_blank(),
panel.border=element_rect(fill="transparent"),
plot.title=element_text(hjust=0.5))+
geom_hline(yintercept=0,lty=2)+
geom_vline(xintercept=0,lty=2)+
geom_point(size=3,aes(col=LOCA))+
xlab(paste("PCA 3 (",round(pca$varprop[3]*100,2),"% )",sep=""))+
ylab(paste("PCA 4 (",round(pca$varprop[4]*100,2),"% )",sep=""))+
scale_colour_manual(name="Location",
values=c(color_med_atl[2],
color_med_atl[1],
color_med_atl[3],
color_med_atl[4]))
p2<-p
data_varpop=data.frame(PC=factor(paste("P",seq(1,10),sep=""),levels=paste("P",seq(1,10),sep="")),VAR=pca$varprop[1:10])
pp<-ggplot(data_varpop,aes(x=PC,y=VAR))+
geom_bar(stat='identity',fill="dodgerblue2",alpha=0.25)+
theme_classic()+
xlab("Principal Component")+
ylab("Variation explained (%)")
```
```{r}
subplot(ggplotly(p1)%>% layout(legend = list(orientation = "h", x = 0.2, y =-0.15)), ggplotly(p2)%>%hide_legend(), ggplotly(pp)%>%hide_legend(), titleX=T,titleY=T,margin=0.035,widths=c(0.375,0.425,0.2),which_layout=1) %>% partial_bundle()
```
### maf = 0.25
```{r}
pca=PCA_list$Prune_filtered$maf0.25[[1]]
data_pca=data.frame(INDIV=pca$sample.id,
PC1=pca$eigenvect[,1],
PC2=pca$eigenvect[,2],
PC3=pca$eigenvect[,3],
PC4=pca$eigenvect[,4],
LOCA=c(rep("Algarve",5),
rep("Bay of Biscay",5),
rep("Gulf of Lion",5),
rep("Costa Calida",5)))
color_med_atl=rev(brewer.pal(n=4,name="RdBu"))
p<-ggplot(data=data_pca,aes(x=PC1,y=PC2,label=INDIV))+
theme_minimal()+
theme(panel.grid=element_blank(),
panel.border=element_rect(fill="transparent"),
plot.title=element_text(hjust=0.5))+
geom_hline(yintercept=0,lty=2)+
geom_vline(xintercept=0,lty=2)+
geom_point(size=3,aes(col=LOCA))+
xlab(paste("PCA 1 (",round(pca$varprop[1]*100,2),"% )",sep=""))+
ylab(paste("PCA 2 (",round(pca$varprop[2]*100,2),"% )",sep=""))+
scale_colour_manual(name="Location",
values=c(color_med_atl[2],
color_med_atl[1],
color_med_atl[3],
color_med_atl[4]))
p1<-p
p<-ggplot(data=data_pca,aes(x=PC3,y=PC4,label=INDIV))+
theme_minimal()+
theme(panel.grid=element_blank(),
panel.border=element_rect(fill="transparent"),
plot.title=element_text(hjust=0.5))+
geom_hline(yintercept=0,lty=2)+
geom_vline(xintercept=0,lty=2)+
geom_point(size=3,aes(col=LOCA))+
xlab(paste("PCA 3 (",round(pca$varprop[3]*100,2),"% )",sep=""))+
ylab(paste("PCA 4 (",round(pca$varprop[4]*100,2),"% )",sep=""))+
scale_colour_manual(name="Location",
values=c(color_med_atl[2],
color_med_atl[1],
color_med_atl[3],
color_med_atl[4]))
p2<-p
data_varpop=data.frame(PC=factor(paste("P",seq(1,10),sep=""),levels=paste("P",seq(1,10),sep="")),VAR=pca$varprop[1:10])
pp<-ggplot(data_varpop,aes(x=PC,y=VAR))+
geom_bar(stat='identity',fill="dodgerblue2",alpha=0.25)+
theme_classic()+
xlab("Principal Component")+
ylab("Variation explained (%)")
```
```{r}
subplot(ggplotly(p1)%>% layout(legend = list(orientation = "h", x = 0.2, y =-0.15)), ggplotly(p2)%>%hide_legend(), ggplotly(pp)%>%hide_legend(), titleX=T,titleY=T,margin=0.035,widths=c(0.375,0.425,0.2),which_layout=1) %>% partial_bundle()
```
### maf = 0.30
```{r}
pca=PCA_list$Prune_filtered$maf0.3[[1]]
data_pca=data.frame(INDIV=pca$sample.id,
PC1=pca$eigenvect[,1],
PC2=pca$eigenvect[,2],
PC3=pca$eigenvect[,3],
PC4=pca$eigenvect[,4],
LOCA=c(rep("Algarve",5),
rep("Bay of Biscay",5),
rep("Gulf of Lion",5),
rep("Costa Calida",5)))
color_med_atl=rev(brewer.pal(n=4,name="RdBu"))
p<-ggplot(data=data_pca,aes(x=PC1,y=PC2,label=INDIV))+
theme_minimal()+
theme(panel.grid=element_blank(),
panel.border=element_rect(fill="transparent"),
plot.title=element_text(hjust=0.5))+
geom_hline(yintercept=0,lty=2)+
geom_vline(xintercept=0,lty=2)+
geom_point(size=3,aes(col=LOCA))+
xlab(paste("PCA 1 (",round(pca$varprop[1]*100,2),"% )",sep=""))+
ylab(paste("PCA 2 (",round(pca$varprop[2]*100,2),"% )",sep=""))+
scale_colour_manual(name="Location",
values=c(color_med_atl[2],
color_med_atl[1],
color_med_atl[3],
color_med_atl[4]))
p1<-p
p<-ggplot(data=data_pca,aes(x=PC3,y=PC4,label=INDIV))+
theme_minimal()+
theme(panel.grid=element_blank(),
panel.border=element_rect(fill="transparent"),
plot.title=element_text(hjust=0.5))+
geom_hline(yintercept=0,lty=2)+
geom_vline(xintercept=0,lty=2)+
geom_point(size=3,aes(col=LOCA))+
xlab(paste("PCA 3 (",round(pca$varprop[3]*100,2),"% )",sep=""))+
ylab(paste("PCA 4 (",round(pca$varprop[4]*100,2),"% )",sep=""))+
scale_colour_manual(name="Location",
values=c(color_med_atl[2],
color_med_atl[1],
color_med_atl[3],
color_med_atl[4]))
p2<-p
data_varpop=data.frame(PC=factor(paste("P",seq(1,10),sep=""),levels=paste("P",seq(1,10),sep="")),VAR=pca$varprop[1:10])
pp<-ggplot(data_varpop,aes(x=PC,y=VAR))+
geom_bar(stat='identity',fill="dodgerblue2",alpha=0.25)+
theme_classic()+
xlab("Principal Component")+
ylab("Variation explained (%)")
```
```{r}
subplot(ggplotly(p1)%>% layout(legend = list(orientation = "h", x = 0.2, y =-0.15)), ggplotly(p2)%>%hide_legend(), ggplotly(pp)%>%hide_legend(), titleX=T,titleY=T,margin=0.035,widths=c(0.375,0.425,0.2),which_layout=1) %>% partial_bundle()
```
### maf = 0.35
```{r}
pca=PCA_list$Prune_filtered$maf0.35[[1]]
data_pca=data.frame(INDIV=pca$sample.id,
PC1=pca$eigenvect[,1],
PC2=pca$eigenvect[,2],
PC3=pca$eigenvect[,3],
PC4=pca$eigenvect[,4],
LOCA=c(rep("Algarve",5),
rep("Bay of Biscay",5),
rep("Gulf of Lion",5),
rep("Costa Calida",5)))
color_med_atl=rev(brewer.pal(n=4,name="RdBu"))
p<-ggplot(data=data_pca,aes(x=PC1,y=PC2,label=INDIV))+
theme_minimal()+
theme(panel.grid=element_blank(),
panel.border=element_rect(fill="transparent"),
plot.title=element_text(hjust=0.5))+
geom_hline(yintercept=0,lty=2)+
geom_vline(xintercept=0,lty=2)+
geom_point(size=3,aes(col=LOCA))+
xlab(paste("PCA 1 (",round(pca$varprop[1]*100,2),"% )",sep=""))+
ylab(paste("PCA 2 (",round(pca$varprop[2]*100,2),"% )",sep=""))+
scale_colour_manual(name="Location",
values=c(color_med_atl[2],
color_med_atl[1],
color_med_atl[3],
color_med_atl[4]))
p1<-p
p<-ggplot(data=data_pca,aes(x=PC3,y=PC4,label=INDIV))+
theme_minimal()+
theme(panel.grid=element_blank(),
panel.border=element_rect(fill="transparent"),
plot.title=element_text(hjust=0.5))+
geom_hline(yintercept=0,lty=2)+
geom_vline(xintercept=0,lty=2)+
geom_point(size=3,aes(col=LOCA))+
xlab(paste("PCA 3 (",round(pca$varprop[3]*100,2),"% )",sep=""))+
ylab(paste("PCA 4 (",round(pca$varprop[4]*100,2),"% )",sep=""))+
scale_colour_manual(name="Location",
values=c(color_med_atl[2],
color_med_atl[1],
color_med_atl[3],
color_med_atl[4]))
p2<-p
data_varpop=data.frame(PC=factor(paste("P",seq(1,10),sep=""),levels=paste("P",seq(1,10),sep="")),VAR=pca$varprop[1:10])
pp<-ggplot(data_varpop,aes(x=PC,y=VAR))+
geom_bar(stat='identity',fill="dodgerblue2",alpha=0.25)+
theme_classic()+
xlab("Principal Component")+
ylab("Variation explained (%)")
```
```{r}
subplot(ggplotly(p1)%>% layout(legend = list(orientation = "h", x = 0.2, y =-0.15)), ggplotly(p2)%>%hide_legend(), ggplotly(pp)%>%hide_legend(), titleX=T,titleY=T,margin=0.035,widths=c(0.375,0.425,0.2),which_layout=1) %>% partial_bundle()
```
### maf = 0.40
```{r}
pca=PCA_list$Prune_filtered$maf0.4[[1]]
data_pca=data.frame(INDIV=pca$sample.id,
PC1=pca$eigenvect[,1],
PC2=pca$eigenvect[,2],
PC3=pca$eigenvect[,3],
PC4=pca$eigenvect[,4],
LOCA=c(rep("Algarve",5),
rep("Bay of Biscay",5),
rep("Gulf of Lion",5),
rep("Costa Calida",5)))
color_med_atl=rev(brewer.pal(n=4,name="RdBu"))
p<-ggplot(data=data_pca,aes(x=PC1,y=PC2,label=INDIV))+
theme_minimal()+
theme(panel.grid=element_blank(),
panel.border=element_rect(fill="transparent"),
plot.title=element_text(hjust=0.5))+
geom_hline(yintercept=0,lty=2)+
geom_vline(xintercept=0,lty=2)+
geom_point(size=3,aes(col=LOCA))+
xlab(paste("PCA 1 (",round(pca$varprop[1]*100,2),"% )",sep=""))+
ylab(paste("PCA 2 (",round(pca$varprop[2]*100,2),"% )",sep=""))+
scale_colour_manual(name="Location",
values=c(color_med_atl[2],
color_med_atl[1],
color_med_atl[3],
color_med_atl[4]))
p1<-p
p<-ggplot(data=data_pca,aes(x=PC3,y=PC4,label=INDIV))+
theme_minimal()+
theme(panel.grid=element_blank(),
panel.border=element_rect(fill="transparent"),
plot.title=element_text(hjust=0.5))+
geom_hline(yintercept=0,lty=2)+
geom_vline(xintercept=0,lty=2)+
geom_point(size=3,aes(col=LOCA))+
xlab(paste("PCA 3 (",round(pca$varprop[3]*100,2),"% )",sep=""))+
ylab(paste("PCA 4 (",round(pca$varprop[4]*100,2),"% )",sep=""))+
scale_colour_manual(name="Location",
values=c(color_med_atl[2],
color_med_atl[1],
color_med_atl[3],
color_med_atl[4]))
p2<-p
data_varpop=data.frame(PC=factor(paste("P",seq(1,10),sep=""),levels=paste("P",seq(1,10),sep="")),VAR=pca$varprop[1:10])
pp<-ggplot(data_varpop,aes(x=PC,y=VAR))+
geom_bar(stat='identity',fill="dodgerblue2",alpha=0.25)+
theme_classic()+
xlab("Principal Component")+
ylab("Variation explained (%)")
```
```{r}
subplot(ggplotly(p1)%>% layout(legend = list(orientation = "h", x = 0.2, y =-0.15)), ggplotly(p2)%>%hide_legend(), ggplotly(pp)%>%hide_legend(), titleX=T,titleY=T,margin=0.035,widths=c(0.375,0.425,0.2),which_layout=1) %>% partial_bundle()
```
### maf = 0.45
```{r}
pca=PCA_list$Prune_filtered$maf0.45[[1]]
data_pca=data.frame(INDIV=pca$sample.id,
PC1=pca$eigenvect[,1],
PC2=pca$eigenvect[,2],
PC3=pca$eigenvect[,3],
PC4=pca$eigenvect[,4],
LOCA=c(rep("Algarve",5),
rep("Bay of Biscay",5),
rep("Gulf of Lion",5),
rep("Costa Calida",5)))
color_med_atl=rev(brewer.pal(n=4,name="RdBu"))
p<-ggplot(data=data_pca,aes(x=PC1,y=PC2,label=INDIV))+
theme_minimal()+
theme(panel.grid=element_blank(),
panel.border=element_rect(fill="transparent"),
plot.title=element_text(hjust=0.5))+
geom_hline(yintercept=0,lty=2)+
geom_vline(xintercept=0,lty=2)+
geom_point(size=3,aes(col=LOCA))+
xlab(paste("PCA 1 (",round(pca$varprop[1]*100,2),"% )",sep=""))+
ylab(paste("PCA 2 (",round(pca$varprop[2]*100,2),"% )",sep=""))+
scale_colour_manual(name="Location",
values=c(color_med_atl[2],
color_med_atl[1],
color_med_atl[3],
color_med_atl[4]))
p1<-p
p<-ggplot(data=data_pca,aes(x=PC3,y=PC4,label=INDIV))+
theme_minimal()+
theme(panel.grid=element_blank(),
panel.border=element_rect(fill="transparent"),
plot.title=element_text(hjust=0.5))+
geom_hline(yintercept=0,lty=2)+
geom_vline(xintercept=0,lty=2)+
geom_point(size=3,aes(col=LOCA))+
xlab(paste("PCA 3 (",round(pca$varprop[3]*100,2),"% )",sep=""))+
ylab(paste("PCA 4 (",round(pca$varprop[4]*100,2),"% )",sep=""))+
scale_colour_manual(name="Location",
values=c(color_med_atl[2],
color_med_atl[1],
color_med_atl[3],
color_med_atl[4]))
p2<-p
data_varpop=data.frame(PC=factor(paste("P",seq(1,10),sep=""),levels=paste("P",seq(1,10),sep="")),VAR=pca$varprop[1:10])
pp<-ggplot(data_varpop,aes(x=PC,y=VAR))+
geom_bar(stat='identity',fill="dodgerblue2",alpha=0.25)+
theme_classic()+
xlab("Principal Component")+
ylab("Variation explained (%)")
```
```{r}
subplot(ggplotly(p1)%>% layout(legend = list(orientation = "h", x = 0.2, y =-0.15)), ggplotly(p2)%>%hide_legend(), ggplotly(pp)%>%hide_legend(), titleX=T,titleY=T,margin=0.035,widths=c(0.375,0.425,0.2),which_layout=1) %>% partial_bundle()
```
### maf = 0.50
```{r}
pca=PCA_list$Prune_filtered$maf0.5[[1]]
data_pca=data.frame(INDIV=pca$sample.id,
PC1=pca$eigenvect[,1],
PC2=pca$eigenvect[,2],
PC3=pca$eigenvect[,3],
PC4=pca$eigenvect[,4],
LOCA=c(rep("Algarve",5),
rep("Bay of Biscay",5),
rep("Gulf of Lion",5),
rep("Costa Calida",5)))
color_med_atl=rev(brewer.pal(n=4,name="RdBu"))
p<-ggplot(data=data_pca,aes(x=PC1,y=PC2,label=INDIV))+
theme_minimal()+
theme(panel.grid=element_blank(),
panel.border=element_rect(fill="transparent"),
plot.title=element_text(hjust=0.5))+
geom_hline(yintercept=0,lty=2)+
geom_vline(xintercept=0,lty=2)+
geom_point(size=3,aes(col=LOCA))+
xlab(paste("PCA 1 (",round(pca$varprop[1]*100,2),"% )",sep=""))+
ylab(paste("PCA 2 (",round(pca$varprop[2]*100,2),"% )",sep=""))+
scale_colour_manual(name="Location",
values=c(color_med_atl[2],
color_med_atl[1],
color_med_atl[3],
color_med_atl[4]))
p1<-p
p<-ggplot(data=data_pca,aes(x=PC3,y=PC4,label=INDIV))+
theme_minimal()+
theme(panel.grid=element_blank(),
panel.border=element_rect(fill="transparent"),
plot.title=element_text(hjust=0.5))+
geom_hline(yintercept=0,lty=2)+
geom_vline(xintercept=0,lty=2)+
geom_point(size=3,aes(col=LOCA))+
xlab(paste("PCA 3 (",round(pca$varprop[3]*100,2),"% )",sep=""))+
ylab(paste("PCA 4 (",round(pca$varprop[4]*100,2),"% )",sep=""))+
scale_colour_manual(name="Location",
values=c(color_med_atl[2],
color_med_atl[1],
color_med_atl[3],
color_med_atl[4]))
p2<-p
data_varpop=data.frame(PC=factor(paste("P",seq(1,10),sep=""),levels=paste("P",seq(1,10),sep="")),VAR=pca$varprop[1:10])
pp<-ggplot(data_varpop,aes(x=PC,y=VAR))+
geom_bar(stat='identity',fill="dodgerblue2",alpha=0.25)+
theme_classic()+
xlab("Principal Component")+
ylab("Variation explained (%)")
```
```{r}
subplot(ggplotly(p1)%>% layout(legend = list(orientation = "h", x = 0.2, y =-0.15)), ggplotly(p2)%>%hide_legend(), ggplotly(pp)%>%hide_legend(), titleX=T,titleY=T,margin=0.035,widths=c(0.375,0.425,0.2),which_layout=1) %>% partial_bundle()
```
Row {.tabset data-height=50}
-----------------------
<center>
<font size="6">**All unfiltered SNPS**</font>
</center>
Row {.tabset data-height=600}
-----------------------
### maf = 0
```{r}
pca=PCA_list$All_unfiltered$maf0[[1]]
data_pca=data.frame(INDIV=pca$sample.id,
PC1=pca$eigenvect[,1],
PC2=pca$eigenvect[,2],
PC3=pca$eigenvect[,3],
PC4=pca$eigenvect[,4],
LOCA=c(rep("Algarve",5),
rep("Bay of Biscay",5),
rep("Gulf of Lion",5),
rep("Costa Calida",5)))
color_med_atl=rev(brewer.pal(n=4,name="RdBu"))
p<-ggplot(data=data_pca,aes(x=PC1,y=PC2,label=INDIV))+
theme_minimal()+
theme(panel.grid=element_blank(),
panel.border=element_rect(fill="transparent"),
plot.title=element_text(hjust=0.5))+
geom_hline(yintercept=0,lty=2)+
geom_vline(xintercept=0,lty=2)+
geom_point(size=3,aes(col=LOCA))+
xlab(paste("PCA 1 (",round(pca$varprop[1]*100,2),"% )",sep=""))+
ylab(paste("PCA 2 (",round(pca$varprop[2]*100,2),"% )",sep=""))+
scale_colour_manual(name="Location",
values=c(color_med_atl[2],
color_med_atl[1],
color_med_atl[3],
color_med_atl[4]))
p1<-p
p<-ggplot(data=data_pca,aes(x=PC3,y=PC4,label=INDIV))+
theme_minimal()+
theme(panel.grid=element_blank(),
panel.border=element_rect(fill="transparent"),
plot.title=element_text(hjust=0.5))+
geom_hline(yintercept=0,lty=2)+
geom_vline(xintercept=0,lty=2)+
geom_point(size=3,aes(col=LOCA))+
xlab(paste("PCA 3 (",round(pca$varprop[3]*100,2),"% )",sep=""))+
ylab(paste("PCA 4 (",round(pca$varprop[4]*100,2),"% )",sep=""))+
scale_colour_manual(name="Location",
values=c(color_med_atl[2],
color_med_atl[1],
color_med_atl[3],
color_med_atl[4]))
p2<-p
data_varpop=data.frame(PC=factor(paste("P",seq(1,10),sep=""),levels=paste("P",seq(1,10),sep="")),VAR=pca$varprop[1:10])
pp<-ggplot(data_varpop,aes(x=PC,y=VAR))+
geom_bar(stat='identity',fill="dodgerblue2",alpha=0.25)+
theme_classic()+
xlab("Principal Component")+
ylab("Variation explained (%)")
```
```{r}
subplot(ggplotly(p1)%>% layout(legend = list(orientation = "h", x = 0.2, y =-0.15)), ggplotly(p2)%>%hide_legend(), ggplotly(pp)%>%hide_legend(), titleX=T,titleY=T,margin=0.035,widths=c(0.375,0.425,0.2),which_layout=1) %>% partial_bundle()
```
### maf = 0.05
```{r}
pca=PCA_list$All_unfiltered$maf0.05[[1]]
data_pca=data.frame(INDIV=pca$sample.id,
PC1=pca$eigenvect[,1],
PC2=pca$eigenvect[,2],
PC3=pca$eigenvect[,3],
PC4=pca$eigenvect[,4],
LOCA=c(rep("Algarve",5),
rep("Bay of Biscay",5),
rep("Gulf of Lion",5),
rep("Costa Calida",5)))
color_med_atl=rev(brewer.pal(n=4,name="RdBu"))
p<-ggplot(data=data_pca,aes(x=PC1,y=PC2,label=INDIV))+
theme_minimal()+
theme(panel.grid=element_blank(),
panel.border=element_rect(fill="transparent"),
plot.title=element_text(hjust=0.5))+
geom_hline(yintercept=0,lty=2)+
geom_vline(xintercept=0,lty=2)+
geom_point(size=3,aes(col=LOCA))+
xlab(paste("PCA 1 (",round(pca$varprop[1]*100,2),"% )",sep=""))+
ylab(paste("PCA 2 (",round(pca$varprop[2]*100,2),"% )",sep=""))+
scale_colour_manual(name="Location",
values=c(color_med_atl[2],
color_med_atl[1],
color_med_atl[3],
color_med_atl[4]))
p1<-p
p<-ggplot(data=data_pca,aes(x=PC3,y=PC4,label=INDIV))+
theme_minimal()+
theme(panel.grid=element_blank(),
panel.border=element_rect(fill="transparent"),
plot.title=element_text(hjust=0.5))+
geom_hline(yintercept=0,lty=2)+
geom_vline(xintercept=0,lty=2)+
geom_point(size=3,aes(col=LOCA))+
xlab(paste("PCA 3 (",round(pca$varprop[3]*100,2),"% )",sep=""))+
ylab(paste("PCA 4 (",round(pca$varprop[4]*100,2),"% )",sep=""))+
scale_colour_manual(name="Location",
values=c(color_med_atl[2],
color_med_atl[1],
color_med_atl[3],
color_med_atl[4]))
p2<-p
data_varpop=data.frame(PC=factor(paste("P",seq(1,10),sep=""),levels=paste("P",seq(1,10),sep="")),VAR=pca$varprop[1:10])
pp<-ggplot(data_varpop,aes(x=PC,y=VAR))+
geom_bar(stat='identity',fill="dodgerblue2",alpha=0.25)+
theme_classic()+
xlab("Principal Component")+
ylab("Variation explained (%)")
```
```{r}
subplot(ggplotly(p1)%>% layout(legend = list(orientation = "h", x = 0.2, y =-0.15)), ggplotly(p2)%>%hide_legend(), ggplotly(pp)%>%hide_legend(), titleX=T,titleY=T,margin=0.035,widths=c(0.375,0.425,0.2),which_layout=1) %>% partial_bundle()
```
### maf = 0.1
```{r}
pca=PCA_list$All_unfiltered$maf0.1[[1]]
data_pca=data.frame(INDIV=pca$sample.id,
PC1=pca$eigenvect[,1],
PC2=pca$eigenvect[,2],
PC3=pca$eigenvect[,3],
PC4=pca$eigenvect[,4],
LOCA=c(rep("Algarve",5),
rep("Bay of Biscay",5),
rep("Gulf of Lion",5),
rep("Costa Calida",5)))
color_med_atl=rev(brewer.pal(n=4,name="RdBu"))
p<-ggplot(data=data_pca,aes(x=PC1,y=PC2,label=INDIV))+
theme_minimal()+
theme(panel.grid=element_blank(),
panel.border=element_rect(fill="transparent"),
plot.title=element_text(hjust=0.5))+
geom_hline(yintercept=0,lty=2)+
geom_vline(xintercept=0,lty=2)+
geom_point(size=3,aes(col=LOCA))+
xlab(paste("PCA 1 (",round(pca$varprop[1]*100,2),"% )",sep=""))+
ylab(paste("PCA 2 (",round(pca$varprop[2]*100,2),"% )",sep=""))+
scale_colour_manual(name="Location",
values=c(color_med_atl[2],
color_med_atl[1],
color_med_atl[3],
color_med_atl[4]))
p1<-p
p<-ggplot(data=data_pca,aes(x=PC3,y=PC4,label=INDIV))+
theme_minimal()+
theme(panel.grid=element_blank(),
panel.border=element_rect(fill="transparent"),
plot.title=element_text(hjust=0.5))+
geom_hline(yintercept=0,lty=2)+
geom_vline(xintercept=0,lty=2)+
geom_point(size=3,aes(col=LOCA))+
xlab(paste("PCA 3 (",round(pca$varprop[3]*100,2),"% )",sep=""))+
ylab(paste("PCA 4 (",round(pca$varprop[4]*100,2),"% )",sep=""))+
scale_colour_manual(name="Location",
values=c(color_med_atl[2],
color_med_atl[1],
color_med_atl[3],
color_med_atl[4]))
p2<-p
data_varpop=data.frame(PC=factor(paste("P",seq(1,10),sep=""),levels=paste("P",seq(1,10),sep="")),VAR=pca$varprop[1:10])
pp<-ggplot(data_varpop,aes(x=PC,y=VAR))+
geom_bar(stat='identity',fill="dodgerblue2",alpha=0.25)+
theme_classic()+
xlab("Principal Component")+
ylab("Variation explained (%)")
```
```{r}
subplot(ggplotly(p1)%>% layout(legend = list(orientation = "h", x = 0.2, y =-0.15)), ggplotly(p2)%>%hide_legend(), ggplotly(pp)%>%hide_legend(), titleX=T,titleY=T,margin=0.035,widths=c(0.375,0.425,0.2),which_layout=1) %>% partial_bundle()
```
### maf = 0.15
```{r}
pca=PCA_list$All_unfiltered$maf0.15[[1]]
data_pca=data.frame(INDIV=pca$sample.id,
PC1=pca$eigenvect[,1],
PC2=pca$eigenvect[,2],
PC3=pca$eigenvect[,3],
PC4=pca$eigenvect[,4],
LOCA=c(rep("Algarve",5),
rep("Bay of Biscay",5),
rep("Gulf of Lion",5),
rep("Costa Calida",5)))
color_med_atl=rev(brewer.pal(n=4,name="RdBu"))
p<-ggplot(data=data_pca,aes(x=PC1,y=PC2,label=INDIV))+
theme_minimal()+
theme(panel.grid=element_blank(),
panel.border=element_rect(fill="transparent"),
plot.title=element_text(hjust=0.5))+
geom_hline(yintercept=0,lty=2)+
geom_vline(xintercept=0,lty=2)+
geom_point(size=3,aes(col=LOCA))+
xlab(paste("PCA 1 (",round(pca$varprop[1]*100,2),"% )",sep=""))+
ylab(paste("PCA 2 (",round(pca$varprop[2]*100,2),"% )",sep=""))+
scale_colour_manual(name="Location",
values=c(color_med_atl[2],
color_med_atl[1],
color_med_atl[3],
color_med_atl[4]))
p1<-p
p<-ggplot(data=data_pca,aes(x=PC3,y=PC4,label=INDIV))+
theme_minimal()+
theme(panel.grid=element_blank(),
panel.border=element_rect(fill="transparent"),
plot.title=element_text(hjust=0.5))+
geom_hline(yintercept=0,lty=2)+
geom_vline(xintercept=0,lty=2)+
geom_point(size=3,aes(col=LOCA))+
xlab(paste("PCA 3 (",round(pca$varprop[3]*100,2),"% )",sep=""))+
ylab(paste("PCA 4 (",round(pca$varprop[4]*100,2),"% )",sep=""))+
scale_colour_manual(name="Location",
values=c(color_med_atl[2],
color_med_atl[1],
color_med_atl[3],
color_med_atl[4]))
p2<-p
data_varpop=data.frame(PC=factor(paste("P",seq(1,10),sep=""),levels=paste("P",seq(1,10),sep="")),VAR=pca$varprop[1:10])
pp<-ggplot(data_varpop,aes(x=PC,y=VAR))+
geom_bar(stat='identity',fill="dodgerblue2",alpha=0.25)+
theme_classic()+
xlab("Principal Component")+
ylab("Variation explained (%)")
```
```{r}
subplot(ggplotly(p1)%>% layout(legend = list(orientation = "h", x = 0.2, y =-0.15)), ggplotly(p2)%>%hide_legend(), ggplotly(pp)%>%hide_legend(), titleX=T,titleY=T,margin=0.035,widths=c(0.375,0.425,0.2),which_layout=1) %>% partial_bundle()
```
### maf = 0.20
```{r}
pca=PCA_list$All_unfiltered$maf0.2[[1]]
data_pca=data.frame(INDIV=pca$sample.id,
PC1=pca$eigenvect[,1],
PC2=pca$eigenvect[,2],
PC3=pca$eigenvect[,3],
PC4=pca$eigenvect[,4],
LOCA=c(rep("Algarve",5),
rep("Bay of Biscay",5),
rep("Gulf of Lion",5),
rep("Costa Calida",5)))
color_med_atl=rev(brewer.pal(n=4,name="RdBu"))
p<-ggplot(data=data_pca,aes(x=PC1,y=PC2,label=INDIV))+
theme_minimal()+
theme(panel.grid=element_blank(),
panel.border=element_rect(fill="transparent"),
plot.title=element_text(hjust=0.5))+
geom_hline(yintercept=0,lty=2)+
geom_vline(xintercept=0,lty=2)+
geom_point(size=3,aes(col=LOCA))+
xlab(paste("PCA 1 (",round(pca$varprop[1]*100,2),"% )",sep=""))+
ylab(paste("PCA 2 (",round(pca$varprop[2]*100,2),"% )",sep=""))+
scale_colour_manual(name="Location",
values=c(color_med_atl[2],
color_med_atl[1],
color_med_atl[3],
color_med_atl[4]))
p1<-p
p<-ggplot(data=data_pca,aes(x=PC3,y=PC4,label=INDIV))+
theme_minimal()+
theme(panel.grid=element_blank(),
panel.border=element_rect(fill="transparent"),
plot.title=element_text(hjust=0.5))+
geom_hline(yintercept=0,lty=2)+
geom_vline(xintercept=0,lty=2)+
geom_point(size=3,aes(col=LOCA))+
xlab(paste("PCA 3 (",round(pca$varprop[3]*100,2),"% )",sep=""))+
ylab(paste("PCA 4 (",round(pca$varprop[4]*100,2),"% )",sep=""))+
scale_colour_manual(name="Location",
values=c(color_med_atl[2],
color_med_atl[1],
color_med_atl[3],
color_med_atl[4]))
p2<-p
data_varpop=data.frame(PC=factor(paste("P",seq(1,10),sep=""),levels=paste("P",seq(1,10),sep="")),VAR=pca$varprop[1:10])
pp<-ggplot(data_varpop,aes(x=PC,y=VAR))+
geom_bar(stat='identity',fill="dodgerblue2",alpha=0.25)+
theme_classic()+
xlab("Principal Component")+
ylab("Variation explained (%)")
```
```{r}
subplot(ggplotly(p1)%>% layout(legend = list(orientation = "h", x = 0.2, y =-0.15)), ggplotly(p2)%>%hide_legend(), ggplotly(pp)%>%hide_legend(), titleX=T,titleY=T,margin=0.035,widths=c(0.375,0.425,0.2),which_layout=1) %>% partial_bundle()
```
### maf = 0.25
```{r}
pca=PCA_list$All_unfiltered$maf0.25[[1]]
data_pca=data.frame(INDIV=pca$sample.id,
PC1=pca$eigenvect[,1],
PC2=pca$eigenvect[,2],
PC3=pca$eigenvect[,3],
PC4=pca$eigenvect[,4],
LOCA=c(rep("Algarve",5),
rep("Bay of Biscay",5),
rep("Gulf of Lion",5),
rep("Costa Calida",5)))
color_med_atl=rev(brewer.pal(n=4,name="RdBu"))
p<-ggplot(data=data_pca,aes(x=PC1,y=PC2,label=INDIV))+
theme_minimal()+
theme(panel.grid=element_blank(),
panel.border=element_rect(fill="transparent"),
plot.title=element_text(hjust=0.5))+
geom_hline(yintercept=0,lty=2)+
geom_vline(xintercept=0,lty=2)+
geom_point(size=3,aes(col=LOCA))+
xlab(paste("PCA 1 (",round(pca$varprop[1]*100,2),"% )",sep=""))+
ylab(paste("PCA 2 (",round(pca$varprop[2]*100,2),"% )",sep=""))+
scale_colour_manual(name="Location",
values=c(color_med_atl[2],
color_med_atl[1],
color_med_atl[3],
color_med_atl[4]))
p1<-p
p<-ggplot(data=data_pca,aes(x=PC3,y=PC4,label=INDIV))+
theme_minimal()+
theme(panel.grid=element_blank(),
panel.border=element_rect(fill="transparent"),
plot.title=element_text(hjust=0.5))+
geom_hline(yintercept=0,lty=2)+
geom_vline(xintercept=0,lty=2)+
geom_point(size=3,aes(col=LOCA))+
xlab(paste("PCA 3 (",round(pca$varprop[3]*100,2),"% )",sep=""))+
ylab(paste("PCA 4 (",round(pca$varprop[4]*100,2),"% )",sep=""))+
scale_colour_manual(name="Location",
values=c(color_med_atl[2],
color_med_atl[1],
color_med_atl[3],
color_med_atl[4]))
p2<-p
data_varpop=data.frame(PC=factor(paste("P",seq(1,10),sep=""),levels=paste("P",seq(1,10),sep="")),VAR=pca$varprop[1:10])
pp<-ggplot(data_varpop,aes(x=PC,y=VAR))+
geom_bar(stat='identity',fill="dodgerblue2",alpha=0.25)+
theme_classic()+
xlab("Principal Component")+
ylab("Variation explained (%)")
```
```{r}
subplot(ggplotly(p1)%>% layout(legend = list(orientation = "h", x = 0.2, y =-0.15)), ggplotly(p2)%>%hide_legend(), ggplotly(pp)%>%hide_legend(), titleX=T,titleY=T,margin=0.035,widths=c(0.375,0.425,0.2),which_layout=1) %>% partial_bundle()
```
### maf = 0.30
```{r}
pca=PCA_list$All_unfiltered$maf0.3[[1]]
data_pca=data.frame(INDIV=pca$sample.id,
PC1=pca$eigenvect[,1],
PC2=pca$eigenvect[,2],
PC3=pca$eigenvect[,3],
PC4=pca$eigenvect[,4],
LOCA=c(rep("Algarve",5),
rep("Bay of Biscay",5),
rep("Gulf of Lion",5),
rep("Costa Calida",5)))
color_med_atl=rev(brewer.pal(n=4,name="RdBu"))
p<-ggplot(data=data_pca,aes(x=PC1,y=PC2,label=INDIV))+
theme_minimal()+
theme(panel.grid=element_blank(),
panel.border=element_rect(fill="transparent"),
plot.title=element_text(hjust=0.5))+
geom_hline(yintercept=0,lty=2)+
geom_vline(xintercept=0,lty=2)+
geom_point(size=3,aes(col=LOCA))+
xlab(paste("PCA 1 (",round(pca$varprop[1]*100,2),"% )",sep=""))+
ylab(paste("PCA 2 (",round(pca$varprop[2]*100,2),"% )",sep=""))+
scale_colour_manual(name="Location",
values=c(color_med_atl[2],
color_med_atl[1],
color_med_atl[3],
color_med_atl[4]))
p1<-p
p<-ggplot(data=data_pca,aes(x=PC3,y=PC4,label=INDIV))+
theme_minimal()+
theme(panel.grid=element_blank(),
panel.border=element_rect(fill="transparent"),
plot.title=element_text(hjust=0.5))+
geom_hline(yintercept=0,lty=2)+
geom_vline(xintercept=0,lty=2)+
geom_point(size=3,aes(col=LOCA))+
xlab(paste("PCA 3 (",round(pca$varprop[3]*100,2),"% )",sep=""))+
ylab(paste("PCA 4 (",round(pca$varprop[4]*100,2),"% )",sep=""))+
scale_colour_manual(name="Location",
values=c(color_med_atl[2],
color_med_atl[1],
color_med_atl[3],
color_med_atl[4]))
p2<-p
data_varpop=data.frame(PC=factor(paste("P",seq(1,10),sep=""),levels=paste("P",seq(1,10),sep="")),VAR=pca$varprop[1:10])
pp<-ggplot(data_varpop,aes(x=PC,y=VAR))+
geom_bar(stat='identity',fill="dodgerblue2",alpha=0.25)+
theme_classic()+
xlab("Principal Component")+
ylab("Variation explained (%)")
```
```{r}
subplot(ggplotly(p1)%>% layout(legend = list(orientation = "h", x = 0.2, y =-0.15)), ggplotly(p2)%>%hide_legend(), ggplotly(pp)%>%hide_legend(), titleX=T,titleY=T,margin=0.035,widths=c(0.375,0.425,0.2),which_layout=1) %>% partial_bundle()
```
### maf = 0.35
```{r}
pca=PCA_list$All_unfiltered$maf0.35[[1]]
data_pca=data.frame(INDIV=pca$sample.id,
PC1=pca$eigenvect[,1],
PC2=pca$eigenvect[,2],
PC3=pca$eigenvect[,3],
PC4=pca$eigenvect[,4],
LOCA=c(rep("Algarve",5),
rep("Bay of Biscay",5),
rep("Gulf of Lion",5),
rep("Costa Calida",5)))
color_med_atl=rev(brewer.pal(n=4,name="RdBu"))
p<-ggplot(data=data_pca,aes(x=PC1,y=PC2,label=INDIV))+
theme_minimal()+
theme(panel.grid=element_blank(),
panel.border=element_rect(fill="transparent"),
plot.title=element_text(hjust=0.5))+
geom_hline(yintercept=0,lty=2)+
geom_vline(xintercept=0,lty=2)+
geom_point(size=3,aes(col=LOCA))+
xlab(paste("PCA 1 (",round(pca$varprop[1]*100,2),"% )",sep=""))+
ylab(paste("PCA 2 (",round(pca$varprop[2]*100,2),"% )",sep=""))+
scale_colour_manual(name="Location",
values=c(color_med_atl[2],
color_med_atl[1],
color_med_atl[3],
color_med_atl[4]))
p1<-p
p<-ggplot(data=data_pca,aes(x=PC3,y=PC4,label=INDIV))+
theme_minimal()+
theme(panel.grid=element_blank(),
panel.border=element_rect(fill="transparent"),
plot.title=element_text(hjust=0.5))+
geom_hline(yintercept=0,lty=2)+
geom_vline(xintercept=0,lty=2)+
geom_point(size=3,aes(col=LOCA))+
xlab(paste("PCA 3 (",round(pca$varprop[3]*100,2),"% )",sep=""))+
ylab(paste("PCA 4 (",round(pca$varprop[4]*100,2),"% )",sep=""))+
scale_colour_manual(name="Location",
values=c(color_med_atl[2],
color_med_atl[1],
color_med_atl[3],
color_med_atl[4]))
p2<-p
data_varpop=data.frame(PC=factor(paste("P",seq(1,10),sep=""),levels=paste("P",seq(1,10),sep="")),VAR=pca$varprop[1:10])
pp<-ggplot(data_varpop,aes(x=PC,y=VAR))+
geom_bar(stat='identity',fill="dodgerblue2",alpha=0.25)+
theme_classic()+
xlab("Principal Component")+
ylab("Variation explained (%)")
```
```{r}
subplot(ggplotly(p1)%>% layout(legend = list(orientation = "h", x = 0.2, y =-0.15)), ggplotly(p2)%>%hide_legend(), ggplotly(pp)%>%hide_legend(), titleX=T,titleY=T,margin=0.035,widths=c(0.375,0.425,0.2),which_layout=1) %>% partial_bundle()
```
### maf = 0.40
```{r}
pca=PCA_list$All_unfiltered$maf0.4[[1]]
data_pca=data.frame(INDIV=pca$sample.id,
PC1=pca$eigenvect[,1],
PC2=pca$eigenvect[,2],
PC3=pca$eigenvect[,3],
PC4=pca$eigenvect[,4],
LOCA=c(rep("Algarve",5),
rep("Bay of Biscay",5),
rep("Gulf of Lion",5),
rep("Costa Calida",5)))
color_med_atl=rev(brewer.pal(n=4,name="RdBu"))
p<-ggplot(data=data_pca,aes(x=PC1,y=PC2,label=INDIV))+
theme_minimal()+
theme(panel.grid=element_blank(),
panel.border=element_rect(fill="transparent"),
plot.title=element_text(hjust=0.5))+
geom_hline(yintercept=0,lty=2)+
geom_vline(xintercept=0,lty=2)+
geom_point(size=3,aes(col=LOCA))+
xlab(paste("PCA 1 (",round(pca$varprop[1]*100,2),"% )",sep=""))+
ylab(paste("PCA 2 (",round(pca$varprop[2]*100,2),"% )",sep=""))+
scale_colour_manual(name="Location",
values=c(color_med_atl[2],
color_med_atl[1],
color_med_atl[3],
color_med_atl[4]))
p1<-p
p<-ggplot(data=data_pca,aes(x=PC3,y=PC4,label=INDIV))+
theme_minimal()+
theme(panel.grid=element_blank(),
panel.border=element_rect(fill="transparent"),
plot.title=element_text(hjust=0.5))+
geom_hline(yintercept=0,lty=2)+
geom_vline(xintercept=0,lty=2)+
geom_point(size=3,aes(col=LOCA))+
xlab(paste("PCA 3 (",round(pca$varprop[3]*100,2),"% )",sep=""))+
ylab(paste("PCA 4 (",round(pca$varprop[4]*100,2),"% )",sep=""))+
scale_colour_manual(name="Location",
values=c(color_med_atl[2],
color_med_atl[1],
color_med_atl[3],
color_med_atl[4]))
p2<-p
data_varpop=data.frame(PC=factor(paste("P",seq(1,10),sep=""),levels=paste("P",seq(1,10),sep="")),VAR=pca$varprop[1:10])
pp<-ggplot(data_varpop,aes(x=PC,y=VAR))+
geom_bar(stat='identity',fill="dodgerblue2",alpha=0.25)+
theme_classic()+
xlab("Principal Component")+
ylab("Variation explained (%)")
```
```{r}
subplot(ggplotly(p1)%>% layout(legend = list(orientation = "h", x = 0.2, y =-0.15)), ggplotly(p2)%>%hide_legend(), ggplotly(pp)%>%hide_legend(), titleX=T,titleY=T,margin=0.035,widths=c(0.375,0.425,0.2),which_layout=1) %>% partial_bundle()
```
### maf = 0.45
```{r}
pca=PCA_list$All_unfiltered$maf0.45[[1]]
data_pca=data.frame(INDIV=pca$sample.id,
PC1=pca$eigenvect[,1],
PC2=pca$eigenvect[,2],
PC3=pca$eigenvect[,3],
PC4=pca$eigenvect[,4],
LOCA=c(rep("Algarve",5),
rep("Bay of Biscay",5),
rep("Gulf of Lion",5),
rep("Costa Calida",5)))
color_med_atl=rev(brewer.pal(n=4,name="RdBu"))
p<-ggplot(data=data_pca,aes(x=PC1,y=PC2,label=INDIV))+
theme_minimal()+
theme(panel.grid=element_blank(),
panel.border=element_rect(fill="transparent"),
plot.title=element_text(hjust=0.5))+
geom_hline(yintercept=0,lty=2)+
geom_vline(xintercept=0,lty=2)+
geom_point(size=3,aes(col=LOCA))+
xlab(paste("PCA 1 (",round(pca$varprop[1]*100,2),"% )",sep=""))+
ylab(paste("PCA 2 (",round(pca$varprop[2]*100,2),"% )",sep=""))+
scale_colour_manual(name="Location",
values=c(color_med_atl[2],
color_med_atl[1],
color_med_atl[3],
color_med_atl[4]))
p1<-p
p<-ggplot(data=data_pca,aes(x=PC3,y=PC4,label=INDIV))+
theme_minimal()+
theme(panel.grid=element_blank(),
panel.border=element_rect(fill="transparent"),
plot.title=element_text(hjust=0.5))+
geom_hline(yintercept=0,lty=2)+
geom_vline(xintercept=0,lty=2)+
geom_point(size=3,aes(col=LOCA))+
xlab(paste("PCA 3 (",round(pca$varprop[3]*100,2),"% )",sep=""))+
ylab(paste("PCA 4 (",round(pca$varprop[4]*100,2),"% )",sep=""))+
scale_colour_manual(name="Location",
values=c(color_med_atl[2],
color_med_atl[1],
color_med_atl[3],
color_med_atl[4]))
p2<-p
data_varpop=data.frame(PC=factor(paste("P",seq(1,10),sep=""),levels=paste("P",seq(1,10),sep="")),VAR=pca$varprop[1:10])
pp<-ggplot(data_varpop,aes(x=PC,y=VAR))+
geom_bar(stat='identity',fill="dodgerblue2",alpha=0.25)+
theme_classic()+
xlab("Principal Component")+
ylab("Variation explained (%)")
```
```{r}
subplot(ggplotly(p1)%>% layout(legend = list(orientation = "h", x = 0.2, y =-0.15)), ggplotly(p2)%>%hide_legend(), ggplotly(pp)%>%hide_legend(), titleX=T,titleY=T,margin=0.035,widths=c(0.375,0.425,0.2),which_layout=1) %>% partial_bundle()
```
### maf = 0.50
```{r}
pca=PCA_list$All_unfiltered$maf0.5[[1]]
data_pca=data.frame(INDIV=pca$sample.id,
PC1=pca$eigenvect[,1],
PC2=pca$eigenvect[,2],
PC3=pca$eigenvect[,3],
PC4=pca$eigenvect[,4],
LOCA=c(rep("Algarve",5),
rep("Bay of Biscay",5),
rep("Gulf of Lion",5),
rep("Costa Calida",5)))
color_med_atl=rev(brewer.pal(n=4,name="RdBu"))
p<-ggplot(data=data_pca,aes(x=PC1,y=PC2,label=INDIV))+
theme_minimal()+
theme(panel.grid=element_blank(),
panel.border=element_rect(fill="transparent"),
plot.title=element_text(hjust=0.5))+
geom_hline(yintercept=0,lty=2)+
geom_vline(xintercept=0,lty=2)+
geom_point(size=3,aes(col=LOCA))+
xlab(paste("PCA 1 (",round(pca$varprop[1]*100,2),"% )",sep=""))+
ylab(paste("PCA 2 (",round(pca$varprop[2]*100,2),"% )",sep=""))+
scale_colour_manual(name="Location",
values=c(color_med_atl[2],
color_med_atl[1],
color_med_atl[3],
color_med_atl[4]))
p1<-p
p<-ggplot(data=data_pca,aes(x=PC3,y=PC4,label=INDIV))+
theme_minimal()+
theme(panel.grid=element_blank(),
panel.border=element_rect(fill="transparent"),
plot.title=element_text(hjust=0.5))+
geom_hline(yintercept=0,lty=2)+
geom_vline(xintercept=0,lty=2)+
geom_point(size=3,aes(col=LOCA))+
xlab(paste("PCA 3 (",round(pca$varprop[3]*100,2),"% )",sep=""))+
ylab(paste("PCA 4 (",round(pca$varprop[4]*100,2),"% )",sep=""))+
scale_colour_manual(name="Location",
values=c(color_med_atl[2],
color_med_atl[1],
color_med_atl[3],
color_med_atl[4]))
p2<-p
data_varpop=data.frame(PC=factor(paste("P",seq(1,10),sep=""),levels=paste("P",seq(1,10),sep="")),VAR=pca$varprop[1:10])
pp<-ggplot(data_varpop,aes(x=PC,y=VAR))+
geom_bar(stat='identity',fill="dodgerblue2",alpha=0.25)+
theme_classic()+
xlab("Principal Component")+
ylab("Variation explained (%)")
```
```{r}
subplot(ggplotly(p1)%>% layout(legend = list(orientation = "h", x = 0.2, y =-0.15)), ggplotly(p2)%>%hide_legend(), ggplotly(pp)%>%hide_legend(), titleX=T,titleY=T,margin=0.035,widths=c(0.375,0.425,0.2),which_layout=1) %>% partial_bundle()
```
Row {.tabset data-height=50}
-----------------------
<center>
<font size="6">**Pruned unfiltered SNPS**</font>
</center>
Row {.tabset data-height=600}
-----------------------
### maf = 0
```{r}
pca=PCA_list$Prune_unfiltered$maf0[[1]]
data_pca=data.frame(INDIV=pca$sample.id,
PC1=pca$eigenvect[,1],
PC2=pca$eigenvect[,2],
PC3=pca$eigenvect[,3],
PC4=pca$eigenvect[,4],
LOCA=c(rep("Algarve",5),
rep("Bay of Biscay",5),
rep("Gulf of Lion",5),
rep("Costa Calida",5)))
color_med_atl=rev(brewer.pal(n=4,name="RdBu"))
p<-ggplot(data=data_pca,aes(x=PC1,y=PC2,label=INDIV))+
theme_minimal()+
theme(panel.grid=element_blank(),
panel.border=element_rect(fill="transparent"),
plot.title=element_text(hjust=0.5))+
geom_hline(yintercept=0,lty=2)+
geom_vline(xintercept=0,lty=2)+
geom_point(size=3,aes(col=LOCA))+
xlab(paste("PCA 1 (",round(pca$varprop[1]*100,2),"% )",sep=""))+
ylab(paste("PCA 2 (",round(pca$varprop[2]*100,2),"% )",sep=""))+
scale_colour_manual(name="Location",
values=c(color_med_atl[2],
color_med_atl[1],
color_med_atl[3],
color_med_atl[4]))
p1<-p
p<-ggplot(data=data_pca,aes(x=PC3,y=PC4,label=INDIV))+
theme_minimal()+
theme(panel.grid=element_blank(),
panel.border=element_rect(fill="transparent"),
plot.title=element_text(hjust=0.5))+
geom_hline(yintercept=0,lty=2)+
geom_vline(xintercept=0,lty=2)+
geom_point(size=3,aes(col=LOCA))+
xlab(paste("PCA 3 (",round(pca$varprop[3]*100,2),"% )",sep=""))+
ylab(paste("PCA 4 (",round(pca$varprop[4]*100,2),"% )",sep=""))+
scale_colour_manual(name="Location",
values=c(color_med_atl[2],
color_med_atl[1],
color_med_atl[3],
color_med_atl[4]))
p2<-p
data_varpop=data.frame(PC=factor(paste("P",seq(1,10),sep=""),levels=paste("P",seq(1,10),sep="")),VAR=pca$varprop[1:10])
pp<-ggplot(data_varpop,aes(x=PC,y=VAR))+
geom_bar(stat='identity',fill="dodgerblue2",alpha=0.25)+
theme_classic()+
xlab("Principal Component")+
ylab("Variation explained (%)")
```
```{r}
subplot(ggplotly(p1)%>% layout(legend = list(orientation = "h", x = 0.2, y =-0.15)), ggplotly(p2)%>%hide_legend(), ggplotly(pp)%>%hide_legend(), titleX=T,titleY=T,margin=0.035,widths=c(0.375,0.425,0.2),which_layout=1) %>% partial_bundle()
```
### maf = 0.05
```{r}
pca=PCA_list$Prune_unfiltered$maf0.05[[1]]
data_pca=data.frame(INDIV=pca$sample.id,
PC1=pca$eigenvect[,1],
PC2=pca$eigenvect[,2],
PC3=pca$eigenvect[,3],
PC4=pca$eigenvect[,4],
LOCA=c(rep("Algarve",5),
rep("Bay of Biscay",5),
rep("Gulf of Lion",5),
rep("Costa Calida",5)))
color_med_atl=rev(brewer.pal(n=4,name="RdBu"))
p<-ggplot(data=data_pca,aes(x=PC1,y=PC2,label=INDIV))+
theme_minimal()+
theme(panel.grid=element_blank(),
panel.border=element_rect(fill="transparent"),
plot.title=element_text(hjust=0.5))+
geom_hline(yintercept=0,lty=2)+
geom_vline(xintercept=0,lty=2)+
geom_point(size=3,aes(col=LOCA))+
xlab(paste("PCA 1 (",round(pca$varprop[1]*100,2),"% )",sep=""))+
ylab(paste("PCA 2 (",round(pca$varprop[2]*100,2),"% )",sep=""))+
scale_colour_manual(name="Location",
values=c(color_med_atl[2],
color_med_atl[1],
color_med_atl[3],
color_med_atl[4]))
p1<-p
p<-ggplot(data=data_pca,aes(x=PC3,y=PC4,label=INDIV))+
theme_minimal()+
theme(panel.grid=element_blank(),
panel.border=element_rect(fill="transparent"),
plot.title=element_text(hjust=0.5))+
geom_hline(yintercept=0,lty=2)+
geom_vline(xintercept=0,lty=2)+
geom_point(size=3,aes(col=LOCA))+
xlab(paste("PCA 3 (",round(pca$varprop[3]*100,2),"% )",sep=""))+
ylab(paste("PCA 4 (",round(pca$varprop[4]*100,2),"% )",sep=""))+
scale_colour_manual(name="Location",
values=c(color_med_atl[2],
color_med_atl[1],
color_med_atl[3],
color_med_atl[4]))
p2<-p
data_varpop=data.frame(PC=factor(paste("P",seq(1,10),sep=""),levels=paste("P",seq(1,10),sep="")),VAR=pca$varprop[1:10])
pp<-ggplot(data_varpop,aes(x=PC,y=VAR))+
geom_bar(stat='identity',fill="dodgerblue2",alpha=0.25)+
theme_classic()+
xlab("Principal Component")+
ylab("Variation explained (%)")
```
```{r}
subplot(ggplotly(p1)%>% layout(legend = list(orientation = "h", x = 0.2, y =-0.15)), ggplotly(p2)%>%hide_legend(), ggplotly(pp)%>%hide_legend(), titleX=T,titleY=T,margin=0.035,widths=c(0.375,0.425,0.2),which_layout=1) %>% partial_bundle()
```
### maf = 0.1
```{r}
pca=PCA_list$Prune_unfiltered$maf0.1[[1]]
data_pca=data.frame(INDIV=pca$sample.id,
PC1=pca$eigenvect[,1],
PC2=pca$eigenvect[,2],
PC3=pca$eigenvect[,3],
PC4=pca$eigenvect[,4],
LOCA=c(rep("Algarve",5),
rep("Bay of Biscay",5),
rep("Gulf of Lion",5),
rep("Costa Calida",5)))
color_med_atl=rev(brewer.pal(n=4,name="RdBu"))
p<-ggplot(data=data_pca,aes(x=PC1,y=PC2,label=INDIV))+
theme_minimal()+
theme(panel.grid=element_blank(),
panel.border=element_rect(fill="transparent"),
plot.title=element_text(hjust=0.5))+
geom_hline(yintercept=0,lty=2)+
geom_vline(xintercept=0,lty=2)+
geom_point(size=3,aes(col=LOCA))+
xlab(paste("PCA 1 (",round(pca$varprop[1]*100,2),"% )",sep=""))+
ylab(paste("PCA 2 (",round(pca$varprop[2]*100,2),"% )",sep=""))+
scale_colour_manual(name="Location",
values=c(color_med_atl[2],
color_med_atl[1],
color_med_atl[3],
color_med_atl[4]))
p1<-p
p<-ggplot(data=data_pca,aes(x=PC3,y=PC4,label=INDIV))+
theme_minimal()+
theme(panel.grid=element_blank(),
panel.border=element_rect(fill="transparent"),
plot.title=element_text(hjust=0.5))+
geom_hline(yintercept=0,lty=2)+
geom_vline(xintercept=0,lty=2)+
geom_point(size=3,aes(col=LOCA))+
xlab(paste("PCA 3 (",round(pca$varprop[3]*100,2),"% )",sep=""))+
ylab(paste("PCA 4 (",round(pca$varprop[4]*100,2),"% )",sep=""))+
scale_colour_manual(name="Location",
values=c(color_med_atl[2],
color_med_atl[1],
color_med_atl[3],
color_med_atl[4]))
p2<-p
data_varpop=data.frame(PC=factor(paste("P",seq(1,10),sep=""),levels=paste("P",seq(1,10),sep="")),VAR=pca$varprop[1:10])
pp<-ggplot(data_varpop,aes(x=PC,y=VAR))+
geom_bar(stat='identity',fill="dodgerblue2",alpha=0.25)+
theme_classic()+
xlab("Principal Component")+
ylab("Variation explained (%)")
```
```{r}
subplot(ggplotly(p1)%>% layout(legend = list(orientation = "h", x = 0.2, y =-0.15)), ggplotly(p2)%>%hide_legend(), ggplotly(pp)%>%hide_legend(), titleX=T,titleY=T,margin=0.035,widths=c(0.375,0.425,0.2),which_layout=1) %>% partial_bundle()
```
### maf = 0.15
```{r}
pca=PCA_list$Prune_unfiltered$maf0.15[[1]]
data_pca=data.frame(INDIV=pca$sample.id,
PC1=pca$eigenvect[,1],
PC2=pca$eigenvect[,2],
PC3=pca$eigenvect[,3],
PC4=pca$eigenvect[,4],
LOCA=c(rep("Algarve",5),
rep("Bay of Biscay",5),
rep("Gulf of Lion",5),
rep("Costa Calida",5)))
color_med_atl=rev(brewer.pal(n=4,name="RdBu"))
p<-ggplot(data=data_pca,aes(x=PC1,y=PC2,label=INDIV))+
theme_minimal()+
theme(panel.grid=element_blank(),
panel.border=element_rect(fill="transparent"),
plot.title=element_text(hjust=0.5))+
geom_hline(yintercept=0,lty=2)+
geom_vline(xintercept=0,lty=2)+
geom_point(size=3,aes(col=LOCA))+
xlab(paste("PCA 1 (",round(pca$varprop[1]*100,2),"% )",sep=""))+
ylab(paste("PCA 2 (",round(pca$varprop[2]*100,2),"% )",sep=""))+
scale_colour_manual(name="Location",
values=c(color_med_atl[2],
color_med_atl[1],
color_med_atl[3],
color_med_atl[4]))
p1<-p
p<-ggplot(data=data_pca,aes(x=PC3,y=PC4,label=INDIV))+
theme_minimal()+
theme(panel.grid=element_blank(),
panel.border=element_rect(fill="transparent"),
plot.title=element_text(hjust=0.5))+
geom_hline(yintercept=0,lty=2)+
geom_vline(xintercept=0,lty=2)+
geom_point(size=3,aes(col=LOCA))+
xlab(paste("PCA 3 (",round(pca$varprop[3]*100,2),"% )",sep=""))+
ylab(paste("PCA 4 (",round(pca$varprop[4]*100,2),"% )",sep=""))+
scale_colour_manual(name="Location",
values=c(color_med_atl[2],
color_med_atl[1],
color_med_atl[3],
color_med_atl[4]))
p2<-p
data_varpop=data.frame(PC=factor(paste("P",seq(1,10),sep=""),levels=paste("P",seq(1,10),sep="")),VAR=pca$varprop[1:10])
pp<-ggplot(data_varpop,aes(x=PC,y=VAR))+
geom_bar(stat='identity',fill="dodgerblue2",alpha=0.25)+
theme_classic()+
xlab("Principal Component")+
ylab("Variation explained (%)")
```
```{r}
subplot(ggplotly(p1)%>% layout(legend = list(orientation = "h", x = 0.2, y =-0.15)), ggplotly(p2)%>%hide_legend(), ggplotly(pp)%>%hide_legend(), titleX=T,titleY=T,margin=0.035,widths=c(0.375,0.425,0.2),which_layout=1) %>% partial_bundle()
```
### maf = 0.20
```{r}
pca=PCA_list$Prune_unfiltered$maf0.2[[1]]
data_pca=data.frame(INDIV=pca$sample.id,
PC1=pca$eigenvect[,1],
PC2=pca$eigenvect[,2],
PC3=pca$eigenvect[,3],
PC4=pca$eigenvect[,4],
LOCA=c(rep("Algarve",5),
rep("Bay of Biscay",5),
rep("Gulf of Lion",5),
rep("Costa Calida",5)))
color_med_atl=rev(brewer.pal(n=4,name="RdBu"))
p<-ggplot(data=data_pca,aes(x=PC1,y=PC2,label=INDIV))+
theme_minimal()+
theme(panel.grid=element_blank(),
panel.border=element_rect(fill="transparent"),
plot.title=element_text(hjust=0.5))+
geom_hline(yintercept=0,lty=2)+
geom_vline(xintercept=0,lty=2)+
geom_point(size=3,aes(col=LOCA))+
xlab(paste("PCA 1 (",round(pca$varprop[1]*100,2),"% )",sep=""))+
ylab(paste("PCA 2 (",round(pca$varprop[2]*100,2),"% )",sep=""))+
scale_colour_manual(name="Location",
values=c(color_med_atl[2],
color_med_atl[1],
color_med_atl[3],
color_med_atl[4]))
p1<-p
p<-ggplot(data=data_pca,aes(x=PC3,y=PC4,label=INDIV))+
theme_minimal()+
theme(panel.grid=element_blank(),
panel.border=element_rect(fill="transparent"),
plot.title=element_text(hjust=0.5))+
geom_hline(yintercept=0,lty=2)+
geom_vline(xintercept=0,lty=2)+
geom_point(size=3,aes(col=LOCA))+
xlab(paste("PCA 3 (",round(pca$varprop[3]*100,2),"% )",sep=""))+
ylab(paste("PCA 4 (",round(pca$varprop[4]*100,2),"% )",sep=""))+
scale_colour_manual(name="Location",
values=c(color_med_atl[2],
color_med_atl[1],
color_med_atl[3],
color_med_atl[4]))
p2<-p
data_varpop=data.frame(PC=factor(paste("P",seq(1,10),sep=""),levels=paste("P",seq(1,10),sep="")),VAR=pca$varprop[1:10])
pp<-ggplot(data_varpop,aes(x=PC,y=VAR))+
geom_bar(stat='identity',fill="dodgerblue2",alpha=0.25)+
theme_classic()+
xlab("Principal Component")+
ylab("Variation explained (%)")
```
```{r}
subplot(ggplotly(p1)%>% layout(legend = list(orientation = "h", x = 0.2, y =-0.15)), ggplotly(p2)%>%hide_legend(), ggplotly(pp)%>%hide_legend(), titleX=T,titleY=T,margin=0.035,widths=c(0.375,0.425,0.2),which_layout=1) %>% partial_bundle()
```
### maf = 0.25
```{r}
pca=PCA_list$Prune_unfiltered$maf0.25[[1]]
data_pca=data.frame(INDIV=pca$sample.id,
PC1=pca$eigenvect[,1],
PC2=pca$eigenvect[,2],
PC3=pca$eigenvect[,3],
PC4=pca$eigenvect[,4],
LOCA=c(rep("Algarve",5),
rep("Bay of Biscay",5),
rep("Gulf of Lion",5),
rep("Costa Calida",5)))
color_med_atl=rev(brewer.pal(n=4,name="RdBu"))
p<-ggplot(data=data_pca,aes(x=PC1,y=PC2,label=INDIV))+
theme_minimal()+
theme(panel.grid=element_blank(),
panel.border=element_rect(fill="transparent"),
plot.title=element_text(hjust=0.5))+
geom_hline(yintercept=0,lty=2)+
geom_vline(xintercept=0,lty=2)+
geom_point(size=3,aes(col=LOCA))+
xlab(paste("PCA 1 (",round(pca$varprop[1]*100,2),"% )",sep=""))+
ylab(paste("PCA 2 (",round(pca$varprop[2]*100,2),"% )",sep=""))+
scale_colour_manual(name="Location",
values=c(color_med_atl[2],
color_med_atl[1],
color_med_atl[3],
color_med_atl[4]))
p1<-p
p<-ggplot(data=data_pca,aes(x=PC3,y=PC4,label=INDIV))+
theme_minimal()+
theme(panel.grid=element_blank(),
panel.border=element_rect(fill="transparent"),
plot.title=element_text(hjust=0.5))+
geom_hline(yintercept=0,lty=2)+
geom_vline(xintercept=0,lty=2)+
geom_point(size=3,aes(col=LOCA))+
xlab(paste("PCA 3 (",round(pca$varprop[3]*100,2),"% )",sep=""))+
ylab(paste("PCA 4 (",round(pca$varprop[4]*100,2),"% )",sep=""))+
scale_colour_manual(name="Location",
values=c(color_med_atl[2],
color_med_atl[1],
color_med_atl[3],
color_med_atl[4]))
p2<-p
data_varpop=data.frame(PC=factor(paste("P",seq(1,10),sep=""),levels=paste("P",seq(1,10),sep="")),VAR=pca$varprop[1:10])
pp<-ggplot(data_varpop,aes(x=PC,y=VAR))+
geom_bar(stat='identity',fill="dodgerblue2",alpha=0.25)+
theme_classic()+
xlab("Principal Component")+
ylab("Variation explained (%)")
```
```{r}
subplot(ggplotly(p1)%>% layout(legend = list(orientation = "h", x = 0.2, y =-0.15)), ggplotly(p2)%>%hide_legend(), ggplotly(pp)%>%hide_legend(), titleX=T,titleY=T,margin=0.035,widths=c(0.375,0.425,0.2),which_layout=1) %>% partial_bundle()
```
### maf = 0.30
```{r}
pca=PCA_list$Prune_unfiltered$maf0.3[[1]]
data_pca=data.frame(INDIV=pca$sample.id,
PC1=pca$eigenvect[,1],
PC2=pca$eigenvect[,2],
PC3=pca$eigenvect[,3],
PC4=pca$eigenvect[,4],
LOCA=c(rep("Algarve",5),
rep("Bay of Biscay",5),
rep("Gulf of Lion",5),
rep("Costa Calida",5)))
color_med_atl=rev(brewer.pal(n=4,name="RdBu"))
p<-ggplot(data=data_pca,aes(x=PC1,y=PC2,label=INDIV))+
theme_minimal()+
theme(panel.grid=element_blank(),
panel.border=element_rect(fill="transparent"),
plot.title=element_text(hjust=0.5))+
geom_hline(yintercept=0,lty=2)+
geom_vline(xintercept=0,lty=2)+
geom_point(size=3,aes(col=LOCA))+
xlab(paste("PCA 1 (",round(pca$varprop[1]*100,2),"% )",sep=""))+
ylab(paste("PCA 2 (",round(pca$varprop[2]*100,2),"% )",sep=""))+
scale_colour_manual(name="Location",
values=c(color_med_atl[2],
color_med_atl[1],
color_med_atl[3],
color_med_atl[4]))
p1<-p
p<-ggplot(data=data_pca,aes(x=PC3,y=PC4,label=INDIV))+
theme_minimal()+
theme(panel.grid=element_blank(),
panel.border=element_rect(fill="transparent"),
plot.title=element_text(hjust=0.5))+
geom_hline(yintercept=0,lty=2)+
geom_vline(xintercept=0,lty=2)+
geom_point(size=3,aes(col=LOCA))+
xlab(paste("PCA 3 (",round(pca$varprop[3]*100,2),"% )",sep=""))+
ylab(paste("PCA 4 (",round(pca$varprop[4]*100,2),"% )",sep=""))+
scale_colour_manual(name="Location",
values=c(color_med_atl[2],
color_med_atl[1],
color_med_atl[3],
color_med_atl[4]))
p2<-p
data_varpop=data.frame(PC=factor(paste("P",seq(1,10),sep=""),levels=paste("P",seq(1,10),sep="")),VAR=pca$varprop[1:10])
pp<-ggplot(data_varpop,aes(x=PC,y=VAR))+
geom_bar(stat='identity',fill="dodgerblue2",alpha=0.25)+
theme_classic()+
xlab("Principal Component")+
ylab("Variation explained (%)")
```
```{r}
subplot(ggplotly(p1)%>% layout(legend = list(orientation = "h", x = 0.2, y =-0.15)), ggplotly(p2)%>%hide_legend(), ggplotly(pp)%>%hide_legend(), titleX=T,titleY=T,margin=0.035,widths=c(0.375,0.425,0.2),which_layout=1) %>% partial_bundle()
```
### maf = 0.35
```{r}
pca=PCA_list$Prune_unfiltered$maf0.35[[1]]
data_pca=data.frame(INDIV=pca$sample.id,
PC1=pca$eigenvect[,1],
PC2=pca$eigenvect[,2],
PC3=pca$eigenvect[,3],
PC4=pca$eigenvect[,4],
LOCA=c(rep("Algarve",5),
rep("Bay of Biscay",5),
rep("Gulf of Lion",5),
rep("Costa Calida",5)))
color_med_atl=rev(brewer.pal(n=4,name="RdBu"))
p<-ggplot(data=data_pca,aes(x=PC1,y=PC2,label=INDIV))+
theme_minimal()+
theme(panel.grid=element_blank(),
panel.border=element_rect(fill="transparent"),
plot.title=element_text(hjust=0.5))+
geom_hline(yintercept=0,lty=2)+
geom_vline(xintercept=0,lty=2)+
geom_point(size=3,aes(col=LOCA))+
xlab(paste("PCA 1 (",round(pca$varprop[1]*100,2),"% )",sep=""))+
ylab(paste("PCA 2 (",round(pca$varprop[2]*100,2),"% )",sep=""))+
scale_colour_manual(name="Location",
values=c(color_med_atl[2],
color_med_atl[1],
color_med_atl[3],
color_med_atl[4]))
p1<-p
p<-ggplot(data=data_pca,aes(x=PC3,y=PC4,label=INDIV))+
theme_minimal()+
theme(panel.grid=element_blank(),
panel.border=element_rect(fill="transparent"),
plot.title=element_text(hjust=0.5))+
geom_hline(yintercept=0,lty=2)+
geom_vline(xintercept=0,lty=2)+
geom_point(size=3,aes(col=LOCA))+
xlab(paste("PCA 3 (",round(pca$varprop[3]*100,2),"% )",sep=""))+
ylab(paste("PCA 4 (",round(pca$varprop[4]*100,2),"% )",sep=""))+
scale_colour_manual(name="Location",
values=c(color_med_atl[2],
color_med_atl[1],
color_med_atl[3],
color_med_atl[4]))
p2<-p
data_varpop=data.frame(PC=factor(paste("P",seq(1,10),sep=""),levels=paste("P",seq(1,10),sep="")),VAR=pca$varprop[1:10])
pp<-ggplot(data_varpop,aes(x=PC,y=VAR))+
geom_bar(stat='identity',fill="dodgerblue2",alpha=0.25)+
theme_classic()+
xlab("Principal Component")+
ylab("Variation explained (%)")
```
```{r}
subplot(ggplotly(p1)%>% layout(legend = list(orientation = "h", x = 0.2, y =-0.15)), ggplotly(p2)%>%hide_legend(), ggplotly(pp)%>%hide_legend(), titleX=T,titleY=T,margin=0.035,widths=c(0.375,0.425,0.2),which_layout=1) %>% partial_bundle()
```
### maf = 0.40
```{r}
pca=PCA_list$Prune_unfiltered$maf0.4[[1]]
data_pca=data.frame(INDIV=pca$sample.id,
PC1=pca$eigenvect[,1],
PC2=pca$eigenvect[,2],
PC3=pca$eigenvect[,3],
PC4=pca$eigenvect[,4],
LOCA=c(rep("Algarve",5),
rep("Bay of Biscay",5),
rep("Gulf of Lion",5),
rep("Costa Calida",5)))
color_med_atl=rev(brewer.pal(n=4,name="RdBu"))
p<-ggplot(data=data_pca,aes(x=PC1,y=PC2,label=INDIV))+
theme_minimal()+
theme(panel.grid=element_blank(),
panel.border=element_rect(fill="transparent"),
plot.title=element_text(hjust=0.5))+
geom_hline(yintercept=0,lty=2)+
geom_vline(xintercept=0,lty=2)+
geom_point(size=3,aes(col=LOCA))+
xlab(paste("PCA 1 (",round(pca$varprop[1]*100,2),"% )",sep=""))+
ylab(paste("PCA 2 (",round(pca$varprop[2]*100,2),"% )",sep=""))+
scale_colour_manual(name="Location",
values=c(color_med_atl[2],
color_med_atl[1],
color_med_atl[3],
color_med_atl[4]))
p1<-p
p<-ggplot(data=data_pca,aes(x=PC3,y=PC4,label=INDIV))+
theme_minimal()+
theme(panel.grid=element_blank(),
panel.border=element_rect(fill="transparent"),
plot.title=element_text(hjust=0.5))+
geom_hline(yintercept=0,lty=2)+
geom_vline(xintercept=0,lty=2)+
geom_point(size=3,aes(col=LOCA))+
xlab(paste("PCA 3 (",round(pca$varprop[3]*100,2),"% )",sep=""))+
ylab(paste("PCA 4 (",round(pca$varprop[4]*100,2),"% )",sep=""))+
scale_colour_manual(name="Location",
values=c(color_med_atl[2],
color_med_atl[1],
color_med_atl[3],
color_med_atl[4]))
p2<-p
data_varpop=data.frame(PC=factor(paste("P",seq(1,10),sep=""),levels=paste("P",seq(1,10),sep="")),VAR=pca$varprop[1:10])
pp<-ggplot(data_varpop,aes(x=PC,y=VAR))+
geom_bar(stat='identity',fill="dodgerblue2",alpha=0.25)+
theme_classic()+
xlab("Principal Component")+
ylab("Variation explained (%)")
```
```{r}
subplot(ggplotly(p1)%>% layout(legend = list(orientation = "h", x = 0.2, y =-0.15)), ggplotly(p2)%>%hide_legend(), ggplotly(pp)%>%hide_legend(), titleX=T,titleY=T,margin=0.035,widths=c(0.375,0.425,0.2),which_layout=1) %>% partial_bundle()
```
### maf = 0.45
```{r}
pca=PCA_list$Prune_unfiltered$maf0.45[[1]]
data_pca=data.frame(INDIV=pca$sample.id,
PC1=pca$eigenvect[,1],
PC2=pca$eigenvect[,2],
PC3=pca$eigenvect[,3],
PC4=pca$eigenvect[,4],
LOCA=c(rep("Algarve",5),
rep("Bay of Biscay",5),
rep("Gulf of Lion",5),
rep("Costa Calida",5)))
color_med_atl=rev(brewer.pal(n=4,name="RdBu"))
p<-ggplot(data=data_pca,aes(x=PC1,y=PC2,label=INDIV))+
theme_minimal()+
theme(panel.grid=element_blank(),
panel.border=element_rect(fill="transparent"),
plot.title=element_text(hjust=0.5))+
geom_hline(yintercept=0,lty=2)+
geom_vline(xintercept=0,lty=2)+
geom_point(size=3,aes(col=LOCA))+
xlab(paste("PCA 1 (",round(pca$varprop[1]*100,2),"% )",sep=""))+
ylab(paste("PCA 2 (",round(pca$varprop[2]*100,2),"% )",sep=""))+
scale_colour_manual(name="Location",
values=c(color_med_atl[2],
color_med_atl[1],
color_med_atl[3],
color_med_atl[4]))
p1<-p
p<-ggplot(data=data_pca,aes(x=PC3,y=PC4,label=INDIV))+
theme_minimal()+
theme(panel.grid=element_blank(),
panel.border=element_rect(fill="transparent"),
plot.title=element_text(hjust=0.5))+
geom_hline(yintercept=0,lty=2)+
geom_vline(xintercept=0,lty=2)+
geom_point(size=3,aes(col=LOCA))+
xlab(paste("PCA 3 (",round(pca$varprop[3]*100,2),"% )",sep=""))+
ylab(paste("PCA 4 (",round(pca$varprop[4]*100,2),"% )",sep=""))+
scale_colour_manual(name="Location",
values=c(color_med_atl[2],
color_med_atl[1],
color_med_atl[3],
color_med_atl[4]))
p2<-p
data_varpop=data.frame(PC=factor(paste("P",seq(1,10),sep=""),levels=paste("P",seq(1,10),sep="")),VAR=pca$varprop[1:10])
pp<-ggplot(data_varpop,aes(x=PC,y=VAR))+
geom_bar(stat='identity',fill="dodgerblue2",alpha=0.25)+
theme_classic()+
xlab("Principal Component")+
ylab("Variation explained (%)")
```
```{r}
subplot(ggplotly(p1)%>% layout(legend = list(orientation = "h", x = 0.2, y =-0.15)), ggplotly(p2)%>%hide_legend(), ggplotly(pp)%>%hide_legend(), titleX=T,titleY=T,margin=0.035,widths=c(0.375,0.425,0.2),which_layout=1) %>% partial_bundle()
```
### maf = 0.50
```{r}
pca=PCA_list$Prune_unfiltered$maf0.5[[1]]
data_pca=data.frame(INDIV=pca$sample.id,
PC1=pca$eigenvect[,1],
PC2=pca$eigenvect[,2],
PC3=pca$eigenvect[,3],
PC4=pca$eigenvect[,4],
LOCA=c(rep("Algarve",5),
rep("Bay of Biscay",5),
rep("Gulf of Lion",5),
rep("Costa Calida",5)))
color_med_atl=rev(brewer.pal(n=4,name="RdBu"))
p<-ggplot(data=data_pca,aes(x=PC1,y=PC2,label=INDIV))+
theme_minimal()+
theme(panel.grid=element_blank(),
panel.border=element_rect(fill="transparent"),
plot.title=element_text(hjust=0.5))+
geom_hline(yintercept=0,lty=2)+
geom_vline(xintercept=0,lty=2)+
geom_point(size=3,aes(col=LOCA))+
xlab(paste("PCA 1 (",round(pca$varprop[1]*100,2),"% )",sep=""))+
ylab(paste("PCA 2 (",round(pca$varprop[2]*100,2),"% )",sep=""))+
scale_colour_manual(name="Location",
values=c(color_med_atl[2],
color_med_atl[1],
color_med_atl[3],
color_med_atl[4]))
p1<-p
p<-ggplot(data=data_pca,aes(x=PC3,y=PC4,label=INDIV))+
theme_minimal()+
theme(panel.grid=element_blank(),
panel.border=element_rect(fill="transparent"),
plot.title=element_text(hjust=0.5))+
geom_hline(yintercept=0,lty=2)+
geom_vline(xintercept=0,lty=2)+
geom_point(size=3,aes(col=LOCA))+
xlab(paste("PCA 3 (",round(pca$varprop[3]*100,2),"% )",sep=""))+
ylab(paste("PCA 4 (",round(pca$varprop[4]*100,2),"% )",sep=""))+
scale_colour_manual(name="Location",
values=c(color_med_atl[2],
color_med_atl[1],
color_med_atl[3],
color_med_atl[4]))
p2<-p
data_varpop=data.frame(PC=factor(paste("P",seq(1,10),sep=""),levels=paste("P",seq(1,10),sep="")),VAR=pca$varprop[1:10])
pp<-ggplot(data_varpop,aes(x=PC,y=VAR))+
geom_bar(stat='identity',fill="dodgerblue2",alpha=0.25)+
theme_classic()+
xlab("Principal Component")+
ylab("Variation explained (%)")
```
```{r}
subplot(ggplotly(p1)%>% layout(legend = list(orientation = "h", x = 0.2, y =-0.15)), ggplotly(p2)%>%hide_legend(), ggplotly(pp)%>%hide_legend(), titleX=T,titleY=T,margin=0.035,widths=c(0.375,0.425,0.2),which_layout=1) %>% partial_bundle()
```
Mullus surmuletus {data-navmenu="Species"}
=======================================================================
```{r, include = FALSE}
load(file = paste(path,"/output/pca/Msurm_PCA_list.Rdata",sep=""))
```
Row {.tabset data-height=100}
-----------------------
<center>
<font size="6">**Mullus surmuletus**</font>
</center>
Row {.tabset data-height=50}
-----------------------
<center>
<font size="6">**All filtered SNPS**</font>
</center>
Row {.tabset data-height=600}
-----------------------
### maf = 0
```{r}
pca=PCA_list$All_filtered$maf0[[1]]
data_pca=data.frame(INDIV=pca$sample.id,
PC1=pca$eigenvect[,1],
PC2=pca$eigenvect[,2],
PC3=pca$eigenvect[,3],
PC4=pca$eigenvect[,4],
LOCA=c(rep("Algarve",5),
rep("Bay of Biscay",5),
rep("Gulf of Lion",5),
rep("Costa Calida",5)))
color_med_atl=rev(brewer.pal(n=4,name="RdBu"))
p<-ggplot(data=data_pca,aes(x=PC1,y=PC2,label=INDIV))+
theme_minimal()+
theme(panel.grid=element_blank(),
panel.border=element_rect(fill="transparent"),
plot.title=element_text(hjust=0.5))+
geom_hline(yintercept=0,lty=2)+
geom_vline(xintercept=0,lty=2)+
geom_point(size=3,aes(col=LOCA))+
xlab(paste("PCA 1 (",round(pca$varprop[1]*100,2),"% )",sep=""))+
ylab(paste("PCA 2 (",round(pca$varprop[2]*100,2),"% )",sep=""))+
scale_colour_manual(name="Location",
values=c(color_med_atl[2],
color_med_atl[1],
color_med_atl[3],
color_med_atl[4]))
p1<-p
p<-ggplot(data=data_pca,aes(x=PC3,y=PC4,label=INDIV))+
theme_minimal()+
theme(panel.grid=element_blank(),
panel.border=element_rect(fill="transparent"),
plot.title=element_text(hjust=0.5))+
geom_hline(yintercept=0,lty=2)+
geom_vline(xintercept=0,lty=2)+
geom_point(size=3,aes(col=LOCA))+
xlab(paste("PCA 3 (",round(pca$varprop[3]*100,2),"% )",sep=""))+
ylab(paste("PCA 4 (",round(pca$varprop[4]*100,2),"% )",sep=""))+
scale_colour_manual(name="Location",
values=c(color_med_atl[2],
color_med_atl[1],
color_med_atl[3],
color_med_atl[4]))
p2<-p
data_varpop=data.frame(PC=factor(paste("P",seq(1,10),sep=""),levels=paste("P",seq(1,10),sep="")),VAR=pca$varprop[1:10])
pp<-ggplot(data_varpop,aes(x=PC,y=VAR))+
geom_bar(stat='identity',fill="dodgerblue2",alpha=0.25)+
theme_classic()+
xlab("Principal Component")+
ylab("Variation explained (%)")
```
```{r}
subplot(ggplotly(p1)%>% layout(legend = list(orientation = "h", x = 0.2, y =-0.15)), ggplotly(p2)%>%hide_legend(), ggplotly(pp)%>%hide_legend(), titleX=T,titleY=T,margin=0.035,widths=c(0.375,0.425,0.2),which_layout=1) %>% partial_bundle()
```
### maf = 0.05
```{r}
pca=PCA_list$All_filtered$maf0.05[[1]]
data_pca=data.frame(INDIV=pca$sample.id,
PC1=pca$eigenvect[,1],
PC2=pca$eigenvect[,2],
PC3=pca$eigenvect[,3],
PC4=pca$eigenvect[,4],
LOCA=c(rep("Algarve",5),
rep("Bay of Biscay",5),
rep("Gulf of Lion",5),
rep("Costa Calida",5)))
color_med_atl=rev(brewer.pal(n=4,name="RdBu"))
p<-ggplot(data=data_pca,aes(x=PC1,y=PC2,label=INDIV))+
theme_minimal()+
theme(panel.grid=element_blank(),
panel.border=element_rect(fill="transparent"),
plot.title=element_text(hjust=0.5))+
geom_hline(yintercept=0,lty=2)+
geom_vline(xintercept=0,lty=2)+
geom_point(size=3,aes(col=LOCA))+
xlab(paste("PCA 1 (",round(pca$varprop[1]*100,2),"% )",sep=""))+
ylab(paste("PCA 2 (",round(pca$varprop[2]*100,2),"% )",sep=""))+
scale_colour_manual(name="Location",
values=c(color_med_atl[2],
color_med_atl[1],
color_med_atl[3],
color_med_atl[4]))
p1<-p
p<-ggplot(data=data_pca,aes(x=PC3,y=PC4,label=INDIV))+
theme_minimal()+
theme(panel.grid=element_blank(),
panel.border=element_rect(fill="transparent"),
plot.title=element_text(hjust=0.5))+
geom_hline(yintercept=0,lty=2)+
geom_vline(xintercept=0,lty=2)+
geom_point(size=3,aes(col=LOCA))+
xlab(paste("PCA 3 (",round(pca$varprop[3]*100,2),"% )",sep=""))+
ylab(paste("PCA 4 (",round(pca$varprop[4]*100,2),"% )",sep=""))+
scale_colour_manual(name="Location",
values=c(color_med_atl[2],
color_med_atl[1],
color_med_atl[3],
color_med_atl[4]))
p2<-p
data_varpop=data.frame(PC=factor(paste("P",seq(1,10),sep=""),levels=paste("P",seq(1,10),sep="")),VAR=pca$varprop[1:10])
pp<-ggplot(data_varpop,aes(x=PC,y=VAR))+
geom_bar(stat='identity',fill="dodgerblue2",alpha=0.25)+
theme_classic()+
xlab("Principal Component")+
ylab("Variation explained (%)")
```
```{r}
subplot(ggplotly(p1)%>% layout(legend = list(orientation = "h", x = 0.2, y =-0.15)), ggplotly(p2)%>%hide_legend(), ggplotly(pp)%>%hide_legend(), titleX=T,titleY=T,margin=0.035,widths=c(0.375,0.425,0.2),which_layout=1) %>% partial_bundle()
```
### maf = 0.1
```{r}
pca=PCA_list$All_filtered$maf0.1[[1]]
data_pca=data.frame(INDIV=pca$sample.id,
PC1=pca$eigenvect[,1],
PC2=pca$eigenvect[,2],
PC3=pca$eigenvect[,3],
PC4=pca$eigenvect[,4],
LOCA=c(rep("Algarve",5),
rep("Bay of Biscay",5),
rep("Gulf of Lion",5),
rep("Costa Calida",5)))
color_med_atl=rev(brewer.pal(n=4,name="RdBu"))
p<-ggplot(data=data_pca,aes(x=PC1,y=PC2,label=INDIV))+
theme_minimal()+
theme(panel.grid=element_blank(),
panel.border=element_rect(fill="transparent"),
plot.title=element_text(hjust=0.5))+
geom_hline(yintercept=0,lty=2)+
geom_vline(xintercept=0,lty=2)+
geom_point(size=3,aes(col=LOCA))+
xlab(paste("PCA 1 (",round(pca$varprop[1]*100,2),"% )",sep=""))+
ylab(paste("PCA 2 (",round(pca$varprop[2]*100,2),"% )",sep=""))+
scale_colour_manual(name="Location",
values=c(color_med_atl[2],
color_med_atl[1],
color_med_atl[3],
color_med_atl[4]))
p1<-p
p<-ggplot(data=data_pca,aes(x=PC3,y=PC4,label=INDIV))+
theme_minimal()+
theme(panel.grid=element_blank(),
panel.border=element_rect(fill="transparent"),
plot.title=element_text(hjust=0.5))+
geom_hline(yintercept=0,lty=2)+
geom_vline(xintercept=0,lty=2)+
geom_point(size=3,aes(col=LOCA))+
xlab(paste("PCA 3 (",round(pca$varprop[3]*100,2),"% )",sep=""))+
ylab(paste("PCA 4 (",round(pca$varprop[4]*100,2),"% )",sep=""))+
scale_colour_manual(name="Location",
values=c(color_med_atl[2],
color_med_atl[1],
color_med_atl[3],
color_med_atl[4]))
p2<-p
data_varpop=data.frame(PC=factor(paste("P",seq(1,10),sep=""),levels=paste("P",seq(1,10),sep="")),VAR=pca$varprop[1:10])
pp<-ggplot(data_varpop,aes(x=PC,y=VAR))+
geom_bar(stat='identity',fill="dodgerblue2",alpha=0.25)+
theme_classic()+
xlab("Principal Component")+
ylab("Variation explained (%)")
```
```{r}
subplot(ggplotly(p1)%>% layout(legend = list(orientation = "h", x = 0.2, y =-0.15)), ggplotly(p2)%>%hide_legend(), ggplotly(pp)%>%hide_legend(), titleX=T,titleY=T,margin=0.035,widths=c(0.375,0.425,0.2),which_layout=1) %>% partial_bundle()
```
### maf = 0.15
```{r}
pca=PCA_list$All_filtered$maf0.15[[1]]
data_pca=data.frame(INDIV=pca$sample.id,
PC1=pca$eigenvect[,1],
PC2=pca$eigenvect[,2],
PC3=pca$eigenvect[,3],
PC4=pca$eigenvect[,4],
LOCA=c(rep("Algarve",5),
rep("Bay of Biscay",5),
rep("Gulf of Lion",5),
rep("Costa Calida",5)))
color_med_atl=rev(brewer.pal(n=4,name="RdBu"))
p<-ggplot(data=data_pca,aes(x=PC1,y=PC2,label=INDIV))+
theme_minimal()+
theme(panel.grid=element_blank(),
panel.border=element_rect(fill="transparent"),
plot.title=element_text(hjust=0.5))+
geom_hline(yintercept=0,lty=2)+
geom_vline(xintercept=0,lty=2)+
geom_point(size=3,aes(col=LOCA))+
xlab(paste("PCA 1 (",round(pca$varprop[1]*100,2),"% )",sep=""))+
ylab(paste("PCA 2 (",round(pca$varprop[2]*100,2),"% )",sep=""))+
scale_colour_manual(name="Location",
values=c(color_med_atl[2],
color_med_atl[1],
color_med_atl[3],
color_med_atl[4]))
p1<-p
p<-ggplot(data=data_pca,aes(x=PC3,y=PC4,label=INDIV))+
theme_minimal()+
theme(panel.grid=element_blank(),
panel.border=element_rect(fill="transparent"),
plot.title=element_text(hjust=0.5))+
geom_hline(yintercept=0,lty=2)+
geom_vline(xintercept=0,lty=2)+
geom_point(size=3,aes(col=LOCA))+
xlab(paste("PCA 3 (",round(pca$varprop[3]*100,2),"% )",sep=""))+
ylab(paste("PCA 4 (",round(pca$varprop[4]*100,2),"% )",sep=""))+
scale_colour_manual(name="Location",
values=c(color_med_atl[2],
color_med_atl[1],
color_med_atl[3],
color_med_atl[4]))
p2<-p
data_varpop=data.frame(PC=factor(paste("P",seq(1,10),sep=""),levels=paste("P",seq(1,10),sep="")),VAR=pca$varprop[1:10])
pp<-ggplot(data_varpop,aes(x=PC,y=VAR))+
geom_bar(stat='identity',fill="dodgerblue2",alpha=0.25)+
theme_classic()+
xlab("Principal Component")+
ylab("Variation explained (%)")
```
```{r}
subplot(ggplotly(p1)%>% layout(legend = list(orientation = "h", x = 0.2, y =-0.15)), ggplotly(p2)%>%hide_legend(), ggplotly(pp)%>%hide_legend(), titleX=T,titleY=T,margin=0.035,widths=c(0.375,0.425,0.2),which_layout=1) %>% partial_bundle()
```
### maf = 0.20
```{r}
pca=PCA_list$All_filtered$maf0.2[[1]]
data_pca=data.frame(INDIV=pca$sample.id,
PC1=pca$eigenvect[,1],
PC2=pca$eigenvect[,2],
PC3=pca$eigenvect[,3],
PC4=pca$eigenvect[,4],
LOCA=c(rep("Algarve",5),
rep("Bay of Biscay",5),
rep("Gulf of Lion",5),
rep("Costa Calida",5)))
color_med_atl=rev(brewer.pal(n=4,name="RdBu"))
p<-ggplot(data=data_pca,aes(x=PC1,y=PC2,label=INDIV))+
theme_minimal()+
theme(panel.grid=element_blank(),
panel.border=element_rect(fill="transparent"),
plot.title=element_text(hjust=0.5))+
geom_hline(yintercept=0,lty=2)+
geom_vline(xintercept=0,lty=2)+
geom_point(size=3,aes(col=LOCA))+
xlab(paste("PCA 1 (",round(pca$varprop[1]*100,2),"% )",sep=""))+
ylab(paste("PCA 2 (",round(pca$varprop[2]*100,2),"% )",sep=""))+
scale_colour_manual(name="Location",
values=c(color_med_atl[2],
color_med_atl[1],
color_med_atl[3],
color_med_atl[4]))
p1<-p
p<-ggplot(data=data_pca,aes(x=PC3,y=PC4,label=INDIV))+
theme_minimal()+
theme(panel.grid=element_blank(),
panel.border=element_rect(fill="transparent"),
plot.title=element_text(hjust=0.5))+
geom_hline(yintercept=0,lty=2)+
geom_vline(xintercept=0,lty=2)+
geom_point(size=3,aes(col=LOCA))+
xlab(paste("PCA 3 (",round(pca$varprop[3]*100,2),"% )",sep=""))+
ylab(paste("PCA 4 (",round(pca$varprop[4]*100,2),"% )",sep=""))+
scale_colour_manual(name="Location",
values=c(color_med_atl[2],
color_med_atl[1],
color_med_atl[3],
color_med_atl[4]))
p2<-p
data_varpop=data.frame(PC=factor(paste("P",seq(1,10),sep=""),levels=paste("P",seq(1,10),sep="")),VAR=pca$varprop[1:10])
pp<-ggplot(data_varpop,aes(x=PC,y=VAR))+
geom_bar(stat='identity',fill="dodgerblue2",alpha=0.25)+
theme_classic()+
xlab("Principal Component")+
ylab("Variation explained (%)")
```
```{r}
subplot(ggplotly(p1)%>% layout(legend = list(orientation = "h", x = 0.2, y =-0.15)), ggplotly(p2)%>%hide_legend(), ggplotly(pp)%>%hide_legend(), titleX=T,titleY=T,margin=0.035,widths=c(0.375,0.425,0.2),which_layout=1) %>% partial_bundle()
```
### maf = 0.25
```{r}
pca=PCA_list$All_filtered$maf0.25[[1]]
data_pca=data.frame(INDIV=pca$sample.id,
PC1=pca$eigenvect[,1],
PC2=pca$eigenvect[,2],
PC3=pca$eigenvect[,3],
PC4=pca$eigenvect[,4],
LOCA=c(rep("Algarve",5),
rep("Bay of Biscay",5),
rep("Gulf of Lion",5),
rep("Costa Calida",5)))
color_med_atl=rev(brewer.pal(n=4,name="RdBu"))
p<-ggplot(data=data_pca,aes(x=PC1,y=PC2,label=INDIV))+
theme_minimal()+
theme(panel.grid=element_blank(),
panel.border=element_rect(fill="transparent"),
plot.title=element_text(hjust=0.5))+
geom_hline(yintercept=0,lty=2)+
geom_vline(xintercept=0,lty=2)+
geom_point(size=3,aes(col=LOCA))+
xlab(paste("PCA 1 (",round(pca$varprop[1]*100,2),"% )",sep=""))+
ylab(paste("PCA 2 (",round(pca$varprop[2]*100,2),"% )",sep=""))+
scale_colour_manual(name="Location",
values=c(color_med_atl[2],
color_med_atl[1],
color_med_atl[3],
color_med_atl[4]))
p1<-p
p<-ggplot(data=data_pca,aes(x=PC3,y=PC4,label=INDIV))+
theme_minimal()+
theme(panel.grid=element_blank(),
panel.border=element_rect(fill="transparent"),
plot.title=element_text(hjust=0.5))+
geom_hline(yintercept=0,lty=2)+
geom_vline(xintercept=0,lty=2)+
geom_point(size=3,aes(col=LOCA))+
xlab(paste("PCA 3 (",round(pca$varprop[3]*100,2),"% )",sep=""))+
ylab(paste("PCA 4 (",round(pca$varprop[4]*100,2),"% )",sep=""))+
scale_colour_manual(name="Location",
values=c(color_med_atl[2],
color_med_atl[1],
color_med_atl[3],
color_med_atl[4]))
p2<-p
data_varpop=data.frame(PC=factor(paste("P",seq(1,10),sep=""),levels=paste("P",seq(1,10),sep="")),VAR=pca$varprop[1:10])
pp<-ggplot(data_varpop,aes(x=PC,y=VAR))+
geom_bar(stat='identity',fill="dodgerblue2",alpha=0.25)+
theme_classic()+
xlab("Principal Component")+
ylab("Variation explained (%)")
```
```{r}
subplot(ggplotly(p1)%>% layout(legend = list(orientation = "h", x = 0.2, y =-0.15)), ggplotly(p2)%>%hide_legend(), ggplotly(pp)%>%hide_legend(), titleX=T,titleY=T,margin=0.035,widths=c(0.375,0.425,0.2),which_layout=1) %>% partial_bundle()
```
### maf = 0.30
```{r}
pca=PCA_list$All_filtered$maf0.3[[1]]
data_pca=data.frame(INDIV=pca$sample.id,
PC1=pca$eigenvect[,1],
PC2=pca$eigenvect[,2],
PC3=pca$eigenvect[,3],
PC4=pca$eigenvect[,4],
LOCA=c(rep("Algarve",5),
rep("Bay of Biscay",5),
rep("Gulf of Lion",5),
rep("Costa Calida",5)))
color_med_atl=rev(brewer.pal(n=4,name="RdBu"))
p<-ggplot(data=data_pca,aes(x=PC1,y=PC2,label=INDIV))+
theme_minimal()+
theme(panel.grid=element_blank(),
panel.border=element_rect(fill="transparent"),
plot.title=element_text(hjust=0.5))+
geom_hline(yintercept=0,lty=2)+
geom_vline(xintercept=0,lty=2)+
geom_point(size=3,aes(col=LOCA))+
xlab(paste("PCA 1 (",round(pca$varprop[1]*100,2),"% )",sep=""))+
ylab(paste("PCA 2 (",round(pca$varprop[2]*100,2),"% )",sep=""))+
scale_colour_manual(name="Location",
values=c(color_med_atl[2],
color_med_atl[1],
color_med_atl[3],
color_med_atl[4]))
p1<-p
p<-ggplot(data=data_pca,aes(x=PC3,y=PC4,label=INDIV))+
theme_minimal()+
theme(panel.grid=element_blank(),
panel.border=element_rect(fill="transparent"),
plot.title=element_text(hjust=0.5))+
geom_hline(yintercept=0,lty=2)+
geom_vline(xintercept=0,lty=2)+
geom_point(size=3,aes(col=LOCA))+
xlab(paste("PCA 3 (",round(pca$varprop[3]*100,2),"% )",sep=""))+
ylab(paste("PCA 4 (",round(pca$varprop[4]*100,2),"% )",sep=""))+
scale_colour_manual(name="Location",
values=c(color_med_atl[2],
color_med_atl[1],
color_med_atl[3],
color_med_atl[4]))
p2<-p
data_varpop=data.frame(PC=factor(paste("P",seq(1,10),sep=""),levels=paste("P",seq(1,10),sep="")),VAR=pca$varprop[1:10])
pp<-ggplot(data_varpop,aes(x=PC,y=VAR))+
geom_bar(stat='identity',fill="dodgerblue2",alpha=0.25)+
theme_classic()+
xlab("Principal Component")+
ylab("Variation explained (%)")
```
```{r}
subplot(ggplotly(p1)%>% layout(legend = list(orientation = "h", x = 0.2, y =-0.15)), ggplotly(p2)%>%hide_legend(), ggplotly(pp)%>%hide_legend(), titleX=T,titleY=T,margin=0.035,widths=c(0.375,0.425,0.2),which_layout=1) %>% partial_bundle()
```
### maf = 0.35
```{r}
pca=PCA_list$All_filtered$maf0.35[[1]]
data_pca=data.frame(INDIV=pca$sample.id,
PC1=pca$eigenvect[,1],
PC2=pca$eigenvect[,2],
PC3=pca$eigenvect[,3],
PC4=pca$eigenvect[,4],
LOCA=c(rep("Algarve",5),
rep("Bay of Biscay",5),
rep("Gulf of Lion",5),
rep("Costa Calida",5)))
color_med_atl=rev(brewer.pal(n=4,name="RdBu"))
p<-ggplot(data=data_pca,aes(x=PC1,y=PC2,label=INDIV))+
theme_minimal()+
theme(panel.grid=element_blank(),
panel.border=element_rect(fill="transparent"),
plot.title=element_text(hjust=0.5))+
geom_hline(yintercept=0,lty=2)+
geom_vline(xintercept=0,lty=2)+
geom_point(size=3,aes(col=LOCA))+
xlab(paste("PCA 1 (",round(pca$varprop[1]*100,2),"% )",sep=""))+
ylab(paste("PCA 2 (",round(pca$varprop[2]*100,2),"% )",sep=""))+
scale_colour_manual(name="Location",
values=c(color_med_atl[2],
color_med_atl[1],
color_med_atl[3],
color_med_atl[4]))
p1<-p
p<-ggplot(data=data_pca,aes(x=PC3,y=PC4,label=INDIV))+
theme_minimal()+
theme(panel.grid=element_blank(),
panel.border=element_rect(fill="transparent"),
plot.title=element_text(hjust=0.5))+
geom_hline(yintercept=0,lty=2)+
geom_vline(xintercept=0,lty=2)+
geom_point(size=3,aes(col=LOCA))+
xlab(paste("PCA 3 (",round(pca$varprop[3]*100,2),"% )",sep=""))+
ylab(paste("PCA 4 (",round(pca$varprop[4]*100,2),"% )",sep=""))+
scale_colour_manual(name="Location",
values=c(color_med_atl[2],
color_med_atl[1],
color_med_atl[3],
color_med_atl[4]))
p2<-p
data_varpop=data.frame(PC=factor(paste("P",seq(1,10),sep=""),levels=paste("P",seq(1,10),sep="")),VAR=pca$varprop[1:10])
pp<-ggplot(data_varpop,aes(x=PC,y=VAR))+
geom_bar(stat='identity',fill="dodgerblue2",alpha=0.25)+
theme_classic()+
xlab("Principal Component")+
ylab("Variation explained (%)")
```
```{r}
subplot(ggplotly(p1)%>% layout(legend = list(orientation = "h", x = 0.2, y =-0.15)), ggplotly(p2)%>%hide_legend(), ggplotly(pp)%>%hide_legend(), titleX=T,titleY=T,margin=0.035,widths=c(0.375,0.425,0.2),which_layout=1) %>% partial_bundle()
```
### maf = 0.40
```{r}
pca=PCA_list$All_filtered$maf0.4[[1]]
data_pca=data.frame(INDIV=pca$sample.id,
PC1=pca$eigenvect[,1],
PC2=pca$eigenvect[,2],
PC3=pca$eigenvect[,3],
PC4=pca$eigenvect[,4],
LOCA=c(rep("Algarve",5),
rep("Bay of Biscay",5),
rep("Gulf of Lion",5),
rep("Costa Calida",5)))
color_med_atl=rev(brewer.pal(n=4,name="RdBu"))
p<-ggplot(data=data_pca,aes(x=PC1,y=PC2,label=INDIV))+
theme_minimal()+
theme(panel.grid=element_blank(),
panel.border=element_rect(fill="transparent"),
plot.title=element_text(hjust=0.5))+
geom_hline(yintercept=0,lty=2)+
geom_vline(xintercept=0,lty=2)+
geom_point(size=3,aes(col=LOCA))+
xlab(paste("PCA 1 (",round(pca$varprop[1]*100,2),"% )",sep=""))+
ylab(paste("PCA 2 (",round(pca$varprop[2]*100,2),"% )",sep=""))+
scale_colour_manual(name="Location",
values=c(color_med_atl[2],
color_med_atl[1],
color_med_atl[3],
color_med_atl[4]))
p1<-p
p<-ggplot(data=data_pca,aes(x=PC3,y=PC4,label=INDIV))+
theme_minimal()+
theme(panel.grid=element_blank(),
panel.border=element_rect(fill="transparent"),
plot.title=element_text(hjust=0.5))+
geom_hline(yintercept=0,lty=2)+
geom_vline(xintercept=0,lty=2)+
geom_point(size=3,aes(col=LOCA))+
xlab(paste("PCA 3 (",round(pca$varprop[3]*100,2),"% )",sep=""))+
ylab(paste("PCA 4 (",round(pca$varprop[4]*100,2),"% )",sep=""))+
scale_colour_manual(name="Location",
values=c(color_med_atl[2],
color_med_atl[1],
color_med_atl[3],
color_med_atl[4]))
p2<-p
data_varpop=data.frame(PC=factor(paste("P",seq(1,10),sep=""),levels=paste("P",seq(1,10),sep="")),VAR=pca$varprop[1:10])
pp<-ggplot(data_varpop,aes(x=PC,y=VAR))+
geom_bar(stat='identity',fill="dodgerblue2",alpha=0.25)+
theme_classic()+
xlab("Principal Component")+
ylab("Variation explained (%)")
```
```{r}
subplot(ggplotly(p1)%>% layout(legend = list(orientation = "h", x = 0.2, y =-0.15)), ggplotly(p2)%>%hide_legend(), ggplotly(pp)%>%hide_legend(), titleX=T,titleY=T,margin=0.035,widths=c(0.375,0.425,0.2),which_layout=1) %>% partial_bundle()
```
### maf = 0.45
```{r}
pca=PCA_list$All_filtered$maf0.45[[1]]
data_pca=data.frame(INDIV=pca$sample.id,
PC1=pca$eigenvect[,1],
PC2=pca$eigenvect[,2],
PC3=pca$eigenvect[,3],
PC4=pca$eigenvect[,4],
LOCA=c(rep("Algarve",5),
rep("Bay of Biscay",5),
rep("Gulf of Lion",5),
rep("Costa Calida",5)))
color_med_atl=rev(brewer.pal(n=4,name="RdBu"))
p<-ggplot(data=data_pca,aes(x=PC1,y=PC2,label=INDIV))+
theme_minimal()+
theme(panel.grid=element_blank(),
panel.border=element_rect(fill="transparent"),
plot.title=element_text(hjust=0.5))+
geom_hline(yintercept=0,lty=2)+
geom_vline(xintercept=0,lty=2)+
geom_point(size=3,aes(col=LOCA))+
xlab(paste("PCA 1 (",round(pca$varprop[1]*100,2),"% )",sep=""))+
ylab(paste("PCA 2 (",round(pca$varprop[2]*100,2),"% )",sep=""))+
scale_colour_manual(name="Location",
values=c(color_med_atl[2],
color_med_atl[1],
color_med_atl[3],
color_med_atl[4]))
p1<-p
p<-ggplot(data=data_pca,aes(x=PC3,y=PC4,label=INDIV))+
theme_minimal()+
theme(panel.grid=element_blank(),
panel.border=element_rect(fill="transparent"),
plot.title=element_text(hjust=0.5))+
geom_hline(yintercept=0,lty=2)+
geom_vline(xintercept=0,lty=2)+
geom_point(size=3,aes(col=LOCA))+
xlab(paste("PCA 3 (",round(pca$varprop[3]*100,2),"% )",sep=""))+
ylab(paste("PCA 4 (",round(pca$varprop[4]*100,2),"% )",sep=""))+
scale_colour_manual(name="Location",
values=c(color_med_atl[2],
color_med_atl[1],
color_med_atl[3],
color_med_atl[4]))
p2<-p
data_varpop=data.frame(PC=factor(paste("P",seq(1,10),sep=""),levels=paste("P",seq(1,10),sep="")),VAR=pca$varprop[1:10])
pp<-ggplot(data_varpop,aes(x=PC,y=VAR))+
geom_bar(stat='identity',fill="dodgerblue2",alpha=0.25)+
theme_classic()+
xlab("Principal Component")+
ylab("Variation explained (%)")
```
```{r}
subplot(ggplotly(p1)%>% layout(legend = list(orientation = "h", x = 0.2, y =-0.15)), ggplotly(p2)%>%hide_legend(), ggplotly(pp)%>%hide_legend(), titleX=T,titleY=T,margin=0.035,widths=c(0.375,0.425,0.2),which_layout=1) %>% partial_bundle()
```
### maf = 0.50
```{r}
pca=PCA_list$All_filtered$maf0.5[[1]]
data_pca=data.frame(INDIV=pca$sample.id,
PC1=pca$eigenvect[,1],
PC2=pca$eigenvect[,2],
PC3=pca$eigenvect[,3],
PC4=pca$eigenvect[,4],
LOCA=c(rep("Algarve",5),
rep("Bay of Biscay",5),
rep("Gulf of Lion",5),
rep("Costa Calida",5)))
color_med_atl=rev(brewer.pal(n=4,name="RdBu"))
p<-ggplot(data=data_pca,aes(x=PC1,y=PC2,label=INDIV))+
theme_minimal()+
theme(panel.grid=element_blank(),
panel.border=element_rect(fill="transparent"),
plot.title=element_text(hjust=0.5))+
geom_hline(yintercept=0,lty=2)+
geom_vline(xintercept=0,lty=2)+
geom_point(size=3,aes(col=LOCA))+
xlab(paste("PCA 1 (",round(pca$varprop[1]*100,2),"% )",sep=""))+
ylab(paste("PCA 2 (",round(pca$varprop[2]*100,2),"% )",sep=""))+
scale_colour_manual(name="Location",
values=c(color_med_atl[2],
color_med_atl[1],
color_med_atl[3],
color_med_atl[4]))
p1<-p
p<-ggplot(data=data_pca,aes(x=PC3,y=PC4,label=INDIV))+
theme_minimal()+
theme(panel.grid=element_blank(),
panel.border=element_rect(fill="transparent"),
plot.title=element_text(hjust=0.5))+
geom_hline(yintercept=0,lty=2)+
geom_vline(xintercept=0,lty=2)+
geom_point(size=3,aes(col=LOCA))+
xlab(paste("PCA 3 (",round(pca$varprop[3]*100,2),"% )",sep=""))+
ylab(paste("PCA 4 (",round(pca$varprop[4]*100,2),"% )",sep=""))+
scale_colour_manual(name="Location",
values=c(color_med_atl[2],
color_med_atl[1],
color_med_atl[3],
color_med_atl[4]))
p2<-p
data_varpop=data.frame(PC=factor(paste("P",seq(1,10),sep=""),levels=paste("P",seq(1,10),sep="")),VAR=pca$varprop[1:10])
pp<-ggplot(data_varpop,aes(x=PC,y=VAR))+
geom_bar(stat='identity',fill="dodgerblue2",alpha=0.25)+
theme_classic()+
xlab("Principal Component")+
ylab("Variation explained (%)")
```
```{r}
subplot(ggplotly(p1)%>% layout(legend = list(orientation = "h", x = 0.2, y =-0.15)), ggplotly(p2)%>%hide_legend(), ggplotly(pp)%>%hide_legend(), titleX=T,titleY=T,margin=0.035,widths=c(0.375,0.425,0.2),which_layout=1) %>% partial_bundle()
```
Row {.tabset data-height=50}
-----------------------
<center>
<font size="6">**Pruned filtered SNPS**</font>
</center>
Row {.tabset data-height=600}
-----------------------
### maf = 0
```{r}
pca=PCA_list$Prune_filtered$maf0[[1]]
data_pca=data.frame(INDIV=pca$sample.id,
PC1=pca$eigenvect[,1],
PC2=pca$eigenvect[,2],
PC3=pca$eigenvect[,3],
PC4=pca$eigenvect[,4],
LOCA=c(rep("Algarve",5),
rep("Bay of Biscay",5),
rep("Gulf of Lion",5),
rep("Costa Calida",5)))
color_med_atl=rev(brewer.pal(n=4,name="RdBu"))
p<-ggplot(data=data_pca,aes(x=PC1,y=PC2,label=INDIV))+
theme_minimal()+
theme(panel.grid=element_blank(),
panel.border=element_rect(fill="transparent"),
plot.title=element_text(hjust=0.5))+
geom_hline(yintercept=0,lty=2)+
geom_vline(xintercept=0,lty=2)+
geom_point(size=3,aes(col=LOCA))+
xlab(paste("PCA 1 (",round(pca$varprop[1]*100,2),"% )",sep=""))+
ylab(paste("PCA 2 (",round(pca$varprop[2]*100,2),"% )",sep=""))+
scale_colour_manual(name="Location",
values=c(color_med_atl[2],
color_med_atl[1],
color_med_atl[3],
color_med_atl[4]))
p1<-p
p<-ggplot(data=data_pca,aes(x=PC3,y=PC4,label=INDIV))+
theme_minimal()+
theme(panel.grid=element_blank(),
panel.border=element_rect(fill="transparent"),
plot.title=element_text(hjust=0.5))+
geom_hline(yintercept=0,lty=2)+
geom_vline(xintercept=0,lty=2)+
geom_point(size=3,aes(col=LOCA))+
xlab(paste("PCA 3 (",round(pca$varprop[3]*100,2),"% )",sep=""))+
ylab(paste("PCA 4 (",round(pca$varprop[4]*100,2),"% )",sep=""))+
scale_colour_manual(name="Location",
values=c(color_med_atl[2],
color_med_atl[1],
color_med_atl[3],
color_med_atl[4]))
p2<-p
data_varpop=data.frame(PC=factor(paste("P",seq(1,10),sep=""),levels=paste("P",seq(1,10),sep="")),VAR=pca$varprop[1:10])
pp<-ggplot(data_varpop,aes(x=PC,y=VAR))+
geom_bar(stat='identity',fill="dodgerblue2",alpha=0.25)+
theme_classic()+
xlab("Principal Component")+
ylab("Variation explained (%)")
```
```{r}
subplot(ggplotly(p1)%>% layout(legend = list(orientation = "h", x = 0.2, y =-0.15)), ggplotly(p2)%>%hide_legend(), ggplotly(pp)%>%hide_legend(), titleX=T,titleY=T,margin=0.035,widths=c(0.375,0.425,0.2),which_layout=1) %>% partial_bundle()
```
### maf = 0.05
```{r}
pca=PCA_list$Prune_filtered$maf0.05[[1]]
data_pca=data.frame(INDIV=pca$sample.id,
PC1=pca$eigenvect[,1],
PC2=pca$eigenvect[,2],
PC3=pca$eigenvect[,3],
PC4=pca$eigenvect[,4],
LOCA=c(rep("Algarve",5),
rep("Bay of Biscay",5),
rep("Gulf of Lion",5),
rep("Costa Calida",5)))
color_med_atl=rev(brewer.pal(n=4,name="RdBu"))
p<-ggplot(data=data_pca,aes(x=PC1,y=PC2,label=INDIV))+
theme_minimal()+
theme(panel.grid=element_blank(),
panel.border=element_rect(fill="transparent"),
plot.title=element_text(hjust=0.5))+
geom_hline(yintercept=0,lty=2)+
geom_vline(xintercept=0,lty=2)+
geom_point(size=3,aes(col=LOCA))+
xlab(paste("PCA 1 (",round(pca$varprop[1]*100,2),"% )",sep=""))+
ylab(paste("PCA 2 (",round(pca$varprop[2]*100,2),"% )",sep=""))+
scale_colour_manual(name="Location",
values=c(color_med_atl[2],
color_med_atl[1],
color_med_atl[3],
color_med_atl[4]))
p1<-p
p<-ggplot(data=data_pca,aes(x=PC3,y=PC4,label=INDIV))+
theme_minimal()+
theme(panel.grid=element_blank(),
panel.border=element_rect(fill="transparent"),
plot.title=element_text(hjust=0.5))+
geom_hline(yintercept=0,lty=2)+
geom_vline(xintercept=0,lty=2)+
geom_point(size=3,aes(col=LOCA))+
xlab(paste("PCA 3 (",round(pca$varprop[3]*100,2),"% )",sep=""))+
ylab(paste("PCA 4 (",round(pca$varprop[4]*100,2),"% )",sep=""))+
scale_colour_manual(name="Location",
values=c(color_med_atl[2],
color_med_atl[1],
color_med_atl[3],
color_med_atl[4]))
p2<-p
data_varpop=data.frame(PC=factor(paste("P",seq(1,10),sep=""),levels=paste("P",seq(1,10),sep="")),VAR=pca$varprop[1:10])
pp<-ggplot(data_varpop,aes(x=PC,y=VAR))+
geom_bar(stat='identity',fill="dodgerblue2",alpha=0.25)+
theme_classic()+
xlab("Principal Component")+
ylab("Variation explained (%)")
```
```{r}
subplot(ggplotly(p1)%>% layout(legend = list(orientation = "h", x = 0.2, y =-0.15)), ggplotly(p2)%>%hide_legend(), ggplotly(pp)%>%hide_legend(), titleX=T,titleY=T,margin=0.035,widths=c(0.375,0.425,0.2),which_layout=1) %>% partial_bundle()
```
### maf = 0.1
```{r}
pca=PCA_list$Prune_filtered$maf0.1[[1]]
data_pca=data.frame(INDIV=pca$sample.id,
PC1=pca$eigenvect[,1],
PC2=pca$eigenvect[,2],
PC3=pca$eigenvect[,3],
PC4=pca$eigenvect[,4],
LOCA=c(rep("Algarve",5),
rep("Bay of Biscay",5),
rep("Gulf of Lion",5),
rep("Costa Calida",5)))
color_med_atl=rev(brewer.pal(n=4,name="RdBu"))
p<-ggplot(data=data_pca,aes(x=PC1,y=PC2,label=INDIV))+
theme_minimal()+
theme(panel.grid=element_blank(),
panel.border=element_rect(fill="transparent"),
plot.title=element_text(hjust=0.5))+
geom_hline(yintercept=0,lty=2)+
geom_vline(xintercept=0,lty=2)+
geom_point(size=3,aes(col=LOCA))+
xlab(paste("PCA 1 (",round(pca$varprop[1]*100,2),"% )",sep=""))+
ylab(paste("PCA 2 (",round(pca$varprop[2]*100,2),"% )",sep=""))+
scale_colour_manual(name="Location",
values=c(color_med_atl[2],
color_med_atl[1],
color_med_atl[3],
color_med_atl[4]))
p1<-p
p<-ggplot(data=data_pca,aes(x=PC3,y=PC4,label=INDIV))+
theme_minimal()+
theme(panel.grid=element_blank(),
panel.border=element_rect(fill="transparent"),
plot.title=element_text(hjust=0.5))+
geom_hline(yintercept=0,lty=2)+
geom_vline(xintercept=0,lty=2)+
geom_point(size=3,aes(col=LOCA))+
xlab(paste("PCA 3 (",round(pca$varprop[3]*100,2),"% )",sep=""))+
ylab(paste("PCA 4 (",round(pca$varprop[4]*100,2),"% )",sep=""))+
scale_colour_manual(name="Location",
values=c(color_med_atl[2],
color_med_atl[1],
color_med_atl[3],
color_med_atl[4]))
p2<-p
data_varpop=data.frame(PC=factor(paste("P",seq(1,10),sep=""),levels=paste("P",seq(1,10),sep="")),VAR=pca$varprop[1:10])
pp<-ggplot(data_varpop,aes(x=PC,y=VAR))+
geom_bar(stat='identity',fill="dodgerblue2",alpha=0.25)+
theme_classic()+
xlab("Principal Component")+
ylab("Variation explained (%)")
```
```{r}
subplot(ggplotly(p1)%>% layout(legend = list(orientation = "h", x = 0.2, y =-0.15)), ggplotly(p2)%>%hide_legend(), ggplotly(pp)%>%hide_legend(), titleX=T,titleY=T,margin=0.035,widths=c(0.375,0.425,0.2),which_layout=1) %>% partial_bundle()
```
### maf = 0.15
```{r}
pca=PCA_list$Prune_filtered$maf0.15[[1]]
data_pca=data.frame(INDIV=pca$sample.id,
PC1=pca$eigenvect[,1],
PC2=pca$eigenvect[,2],
PC3=pca$eigenvect[,3],
PC4=pca$eigenvect[,4],
LOCA=c(rep("Algarve",5),
rep("Bay of Biscay",5),
rep("Gulf of Lion",5),
rep("Costa Calida",5)))
color_med_atl=rev(brewer.pal(n=4,name="RdBu"))
p<-ggplot(data=data_pca,aes(x=PC1,y=PC2,label=INDIV))+
theme_minimal()+
theme(panel.grid=element_blank(),
panel.border=element_rect(fill="transparent"),
plot.title=element_text(hjust=0.5))+
geom_hline(yintercept=0,lty=2)+
geom_vline(xintercept=0,lty=2)+
geom_point(size=3,aes(col=LOCA))+
xlab(paste("PCA 1 (",round(pca$varprop[1]*100,2),"% )",sep=""))+
ylab(paste("PCA 2 (",round(pca$varprop[2]*100,2),"% )",sep=""))+
scale_colour_manual(name="Location",
values=c(color_med_atl[2],
color_med_atl[1],
color_med_atl[3],
color_med_atl[4]))
p1<-p
p<-ggplot(data=data_pca,aes(x=PC3,y=PC4,label=INDIV))+
theme_minimal()+
theme(panel.grid=element_blank(),
panel.border=element_rect(fill="transparent"),
plot.title=element_text(hjust=0.5))+
geom_hline(yintercept=0,lty=2)+
geom_vline(xintercept=0,lty=2)+
geom_point(size=3,aes(col=LOCA))+
xlab(paste("PCA 3 (",round(pca$varprop[3]*100,2),"% )",sep=""))+
ylab(paste("PCA 4 (",round(pca$varprop[4]*100,2),"% )",sep=""))+
scale_colour_manual(name="Location",
values=c(color_med_atl[2],
color_med_atl[1],
color_med_atl[3],
color_med_atl[4]))
p2<-p
data_varpop=data.frame(PC=factor(paste("P",seq(1,10),sep=""),levels=paste("P",seq(1,10),sep="")),VAR=pca$varprop[1:10])
pp<-ggplot(data_varpop,aes(x=PC,y=VAR))+
geom_bar(stat='identity',fill="dodgerblue2",alpha=0.25)+
theme_classic()+
xlab("Principal Component")+
ylab("Variation explained (%)")
```
```{r}
subplot(ggplotly(p1)%>% layout(legend = list(orientation = "h", x = 0.2, y =-0.15)), ggplotly(p2)%>%hide_legend(), ggplotly(pp)%>%hide_legend(), titleX=T,titleY=T,margin=0.035,widths=c(0.375,0.425,0.2),which_layout=1) %>% partial_bundle()
```
### maf = 0.20
```{r}
pca=PCA_list$Prune_filtered$maf0.2[[1]]
data_pca=data.frame(INDIV=pca$sample.id,
PC1=pca$eigenvect[,1],
PC2=pca$eigenvect[,2],
PC3=pca$eigenvect[,3],
PC4=pca$eigenvect[,4],
LOCA=c(rep("Algarve",5),
rep("Bay of Biscay",5),
rep("Gulf of Lion",5),
rep("Costa Calida",5)))
color_med_atl=rev(brewer.pal(n=4,name="RdBu"))
p<-ggplot(data=data_pca,aes(x=PC1,y=PC2,label=INDIV))+
theme_minimal()+
theme(panel.grid=element_blank(),
panel.border=element_rect(fill="transparent"),
plot.title=element_text(hjust=0.5))+
geom_hline(yintercept=0,lty=2)+
geom_vline(xintercept=0,lty=2)+
geom_point(size=3,aes(col=LOCA))+
xlab(paste("PCA 1 (",round(pca$varprop[1]*100,2),"% )",sep=""))+
ylab(paste("PCA 2 (",round(pca$varprop[2]*100,2),"% )",sep=""))+
scale_colour_manual(name="Location",
values=c(color_med_atl[2],
color_med_atl[1],
color_med_atl[3],
color_med_atl[4]))
p1<-p
p<-ggplot(data=data_pca,aes(x=PC3,y=PC4,label=INDIV))+
theme_minimal()+
theme(panel.grid=element_blank(),
panel.border=element_rect(fill="transparent"),
plot.title=element_text(hjust=0.5))+
geom_hline(yintercept=0,lty=2)+
geom_vline(xintercept=0,lty=2)+
geom_point(size=3,aes(col=LOCA))+
xlab(paste("PCA 3 (",round(pca$varprop[3]*100,2),"% )",sep=""))+
ylab(paste("PCA 4 (",round(pca$varprop[4]*100,2),"% )",sep=""))+
scale_colour_manual(name="Location",
values=c(color_med_atl[2],
color_med_atl[1],
color_med_atl[3],
color_med_atl[4]))
p2<-p
data_varpop=data.frame(PC=factor(paste("P",seq(1,10),sep=""),levels=paste("P",seq(1,10),sep="")),VAR=pca$varprop[1:10])
pp<-ggplot(data_varpop,aes(x=PC,y=VAR))+
geom_bar(stat='identity',fill="dodgerblue2",alpha=0.25)+
theme_classic()+
xlab("Principal Component")+
ylab("Variation explained (%)")
```
```{r}
subplot(ggplotly(p1)%>% layout(legend = list(orientation = "h", x = 0.2, y =-0.15)), ggplotly(p2)%>%hide_legend(), ggplotly(pp)%>%hide_legend(), titleX=T,titleY=T,margin=0.035,widths=c(0.375,0.425,0.2),which_layout=1) %>% partial_bundle()
```
### maf = 0.25
```{r}
pca=PCA_list$Prune_filtered$maf0.25[[1]]
data_pca=data.frame(INDIV=pca$sample.id,
PC1=pca$eigenvect[,1],
PC2=pca$eigenvect[,2],
PC3=pca$eigenvect[,3],
PC4=pca$eigenvect[,4],
LOCA=c(rep("Algarve",5),
rep("Bay of Biscay",5),
rep("Gulf of Lion",5),
rep("Costa Calida",5)))
color_med_atl=rev(brewer.pal(n=4,name="RdBu"))
p<-ggplot(data=data_pca,aes(x=PC1,y=PC2,label=INDIV))+
theme_minimal()+
theme(panel.grid=element_blank(),
panel.border=element_rect(fill="transparent"),
plot.title=element_text(hjust=0.5))+
geom_hline(yintercept=0,lty=2)+
geom_vline(xintercept=0,lty=2)+
geom_point(size=3,aes(col=LOCA))+
xlab(paste("PCA 1 (",round(pca$varprop[1]*100,2),"% )",sep=""))+
ylab(paste("PCA 2 (",round(pca$varprop[2]*100,2),"% )",sep=""))+
scale_colour_manual(name="Location",
values=c(color_med_atl[2],
color_med_atl[1],
color_med_atl[3],
color_med_atl[4]))
p1<-p
p<-ggplot(data=data_pca,aes(x=PC3,y=PC4,label=INDIV))+
theme_minimal()+
theme(panel.grid=element_blank(),
panel.border=element_rect(fill="transparent"),
plot.title=element_text(hjust=0.5))+
geom_hline(yintercept=0,lty=2)+
geom_vline(xintercept=0,lty=2)+
geom_point(size=3,aes(col=LOCA))+
xlab(paste("PCA 3 (",round(pca$varprop[3]*100,2),"% )",sep=""))+
ylab(paste("PCA 4 (",round(pca$varprop[4]*100,2),"% )",sep=""))+
scale_colour_manual(name="Location",
values=c(color_med_atl[2],
color_med_atl[1],
color_med_atl[3],
color_med_atl[4]))
p2<-p
data_varpop=data.frame(PC=factor(paste("P",seq(1,10),sep=""),levels=paste("P",seq(1,10),sep="")),VAR=pca$varprop[1:10])
pp<-ggplot(data_varpop,aes(x=PC,y=VAR))+
geom_bar(stat='identity',fill="dodgerblue2",alpha=0.25)+
theme_classic()+
xlab("Principal Component")+
ylab("Variation explained (%)")
```
```{r}
subplot(ggplotly(p1)%>% layout(legend = list(orientation = "h", x = 0.2, y =-0.15)), ggplotly(p2)%>%hide_legend(), ggplotly(pp)%>%hide_legend(), titleX=T,titleY=T,margin=0.035,widths=c(0.375,0.425,0.2),which_layout=1) %>% partial_bundle()
```
### maf = 0.30
```{r}
pca=PCA_list$Prune_filtered$maf0.3[[1]]
data_pca=data.frame(INDIV=pca$sample.id,
PC1=pca$eigenvect[,1],
PC2=pca$eigenvect[,2],
PC3=pca$eigenvect[,3],
PC4=pca$eigenvect[,4],
LOCA=c(rep("Algarve",5),
rep("Bay of Biscay",5),
rep("Gulf of Lion",5),
rep("Costa Calida",5)))
color_med_atl=rev(brewer.pal(n=4,name="RdBu"))
p<-ggplot(data=data_pca,aes(x=PC1,y=PC2,label=INDIV))+
theme_minimal()+
theme(panel.grid=element_blank(),
panel.border=element_rect(fill="transparent"),
plot.title=element_text(hjust=0.5))+
geom_hline(yintercept=0,lty=2)+
geom_vline(xintercept=0,lty=2)+
geom_point(size=3,aes(col=LOCA))+
xlab(paste("PCA 1 (",round(pca$varprop[1]*100,2),"% )",sep=""))+
ylab(paste("PCA 2 (",round(pca$varprop[2]*100,2),"% )",sep=""))+
scale_colour_manual(name="Location",
values=c(color_med_atl[2],
color_med_atl[1],
color_med_atl[3],
color_med_atl[4]))
p1<-p
p<-ggplot(data=data_pca,aes(x=PC3,y=PC4,label=INDIV))+
theme_minimal()+
theme(panel.grid=element_blank(),
panel.border=element_rect(fill="transparent"),
plot.title=element_text(hjust=0.5))+
geom_hline(yintercept=0,lty=2)+
geom_vline(xintercept=0,lty=2)+
geom_point(size=3,aes(col=LOCA))+
xlab(paste("PCA 3 (",round(pca$varprop[3]*100,2),"% )",sep=""))+
ylab(paste("PCA 4 (",round(pca$varprop[4]*100,2),"% )",sep=""))+
scale_colour_manual(name="Location",
values=c(color_med_atl[2],
color_med_atl[1],
color_med_atl[3],
color_med_atl[4]))
p2<-p
data_varpop=data.frame(PC=factor(paste("P",seq(1,10),sep=""),levels=paste("P",seq(1,10),sep="")),VAR=pca$varprop[1:10])
pp<-ggplot(data_varpop,aes(x=PC,y=VAR))+
geom_bar(stat='identity',fill="dodgerblue2",alpha=0.25)+
theme_classic()+
xlab("Principal Component")+
ylab("Variation explained (%)")
```
```{r}
subplot(ggplotly(p1)%>% layout(legend = list(orientation = "h", x = 0.2, y =-0.15)), ggplotly(p2)%>%hide_legend(), ggplotly(pp)%>%hide_legend(), titleX=T,titleY=T,margin=0.035,widths=c(0.375,0.425,0.2),which_layout=1) %>% partial_bundle()
```
### maf = 0.35
```{r}
pca=PCA_list$Prune_filtered$maf0.35[[1]]
data_pca=data.frame(INDIV=pca$sample.id,
PC1=pca$eigenvect[,1],
PC2=pca$eigenvect[,2],
PC3=pca$eigenvect[,3],
PC4=pca$eigenvect[,4],
LOCA=c(rep("Algarve",5),
rep("Bay of Biscay",5),
rep("Gulf of Lion",5),
rep("Costa Calida",5)))
color_med_atl=rev(brewer.pal(n=4,name="RdBu"))
p<-ggplot(data=data_pca,aes(x=PC1,y=PC2,label=INDIV))+
theme_minimal()+
theme(panel.grid=element_blank(),
panel.border=element_rect(fill="transparent"),
plot.title=element_text(hjust=0.5))+
geom_hline(yintercept=0,lty=2)+
geom_vline(xintercept=0,lty=2)+
geom_point(size=3,aes(col=LOCA))+
xlab(paste("PCA 1 (",round(pca$varprop[1]*100,2),"% )",sep=""))+
ylab(paste("PCA 2 (",round(pca$varprop[2]*100,2),"% )",sep=""))+
scale_colour_manual(name="Location",
values=c(color_med_atl[2],
color_med_atl[1],
color_med_atl[3],
color_med_atl[4]))
p1<-p
p<-ggplot(data=data_pca,aes(x=PC3,y=PC4,label=INDIV))+
theme_minimal()+
theme(panel.grid=element_blank(),
panel.border=element_rect(fill="transparent"),
plot.title=element_text(hjust=0.5))+
geom_hline(yintercept=0,lty=2)+
geom_vline(xintercept=0,lty=2)+
geom_point(size=3,aes(col=LOCA))+
xlab(paste("PCA 3 (",round(pca$varprop[3]*100,2),"% )",sep=""))+
ylab(paste("PCA 4 (",round(pca$varprop[4]*100,2),"% )",sep=""))+
scale_colour_manual(name="Location",
values=c(color_med_atl[2],
color_med_atl[1],
color_med_atl[3],
color_med_atl[4]))
p2<-p
data_varpop=data.frame(PC=factor(paste("P",seq(1,10),sep=""),levels=paste("P",seq(1,10),sep="")),VAR=pca$varprop[1:10])
pp<-ggplot(data_varpop,aes(x=PC,y=VAR))+
geom_bar(stat='identity',fill="dodgerblue2",alpha=0.25)+
theme_classic()+
xlab("Principal Component")+
ylab("Variation explained (%)")
```
```{r}
subplot(ggplotly(p1)%>% layout(legend = list(orientation = "h", x = 0.2, y =-0.15)), ggplotly(p2)%>%hide_legend(), ggplotly(pp)%>%hide_legend(), titleX=T,titleY=T,margin=0.035,widths=c(0.375,0.425,0.2),which_layout=1) %>% partial_bundle()
```
### maf = 0.40
```{r}
pca=PCA_list$Prune_filtered$maf0.4[[1]]
data_pca=data.frame(INDIV=pca$sample.id,
PC1=pca$eigenvect[,1],
PC2=pca$eigenvect[,2],
PC3=pca$eigenvect[,3],
PC4=pca$eigenvect[,4],
LOCA=c(rep("Algarve",5),
rep("Bay of Biscay",5),
rep("Gulf of Lion",5),
rep("Costa Calida",5)))
color_med_atl=rev(brewer.pal(n=4,name="RdBu"))
p<-ggplot(data=data_pca,aes(x=PC1,y=PC2,label=INDIV))+
theme_minimal()+
theme(panel.grid=element_blank(),
panel.border=element_rect(fill="transparent"),
plot.title=element_text(hjust=0.5))+
geom_hline(yintercept=0,lty=2)+
geom_vline(xintercept=0,lty=2)+
geom_point(size=3,aes(col=LOCA))+
xlab(paste("PCA 1 (",round(pca$varprop[1]*100,2),"% )",sep=""))+
ylab(paste("PCA 2 (",round(pca$varprop[2]*100,2),"% )",sep=""))+
scale_colour_manual(name="Location",
values=c(color_med_atl[2],
color_med_atl[1],
color_med_atl[3],
color_med_atl[4]))
p1<-p
p<-ggplot(data=data_pca,aes(x=PC3,y=PC4,label=INDIV))+
theme_minimal()+
theme(panel.grid=element_blank(),
panel.border=element_rect(fill="transparent"),
plot.title=element_text(hjust=0.5))+
geom_hline(yintercept=0,lty=2)+
geom_vline(xintercept=0,lty=2)+
geom_point(size=3,aes(col=LOCA))+
xlab(paste("PCA 3 (",round(pca$varprop[3]*100,2),"% )",sep=""))+
ylab(paste("PCA 4 (",round(pca$varprop[4]*100,2),"% )",sep=""))+
scale_colour_manual(name="Location",
values=c(color_med_atl[2],
color_med_atl[1],
color_med_atl[3],
color_med_atl[4]))
p2<-p
data_varpop=data.frame(PC=factor(paste("P",seq(1,10),sep=""),levels=paste("P",seq(1,10),sep="")),VAR=pca$varprop[1:10])
pp<-ggplot(data_varpop,aes(x=PC,y=VAR))+
geom_bar(stat='identity',fill="dodgerblue2",alpha=0.25)+
theme_classic()+
xlab("Principal Component")+
ylab("Variation explained (%)")
```
```{r}
subplot(ggplotly(p1)%>% layout(legend = list(orientation = "h", x = 0.2, y =-0.15)), ggplotly(p2)%>%hide_legend(), ggplotly(pp)%>%hide_legend(), titleX=T,titleY=T,margin=0.035,widths=c(0.375,0.425,0.2),which_layout=1) %>% partial_bundle()
```
### maf = 0.45
```{r}
pca=PCA_list$Prune_filtered$maf0.45[[1]]
data_pca=data.frame(INDIV=pca$sample.id,
PC1=pca$eigenvect[,1],
PC2=pca$eigenvect[,2],
PC3=pca$eigenvect[,3],
PC4=pca$eigenvect[,4],
LOCA=c(rep("Algarve",5),
rep("Bay of Biscay",5),
rep("Gulf of Lion",5),
rep("Costa Calida",5)))
color_med_atl=rev(brewer.pal(n=4,name="RdBu"))
p<-ggplot(data=data_pca,aes(x=PC1,y=PC2,label=INDIV))+
theme_minimal()+
theme(panel.grid=element_blank(),
panel.border=element_rect(fill="transparent"),
plot.title=element_text(hjust=0.5))+
geom_hline(yintercept=0,lty=2)+
geom_vline(xintercept=0,lty=2)+
geom_point(size=3,aes(col=LOCA))+
xlab(paste("PCA 1 (",round(pca$varprop[1]*100,2),"% )",sep=""))+
ylab(paste("PCA 2 (",round(pca$varprop[2]*100,2),"% )",sep=""))+
scale_colour_manual(name="Location",
values=c(color_med_atl[2],
color_med_atl[1],
color_med_atl[3],
color_med_atl[4]))
p1<-p
p<-ggplot(data=data_pca,aes(x=PC3,y=PC4,label=INDIV))+
theme_minimal()+
theme(panel.grid=element_blank(),
panel.border=element_rect(fill="transparent"),
plot.title=element_text(hjust=0.5))+
geom_hline(yintercept=0,lty=2)+
geom_vline(xintercept=0,lty=2)+
geom_point(size=3,aes(col=LOCA))+
xlab(paste("PCA 3 (",round(pca$varprop[3]*100,2),"% )",sep=""))+
ylab(paste("PCA 4 (",round(pca$varprop[4]*100,2),"% )",sep=""))+
scale_colour_manual(name="Location",
values=c(color_med_atl[2],
color_med_atl[1],
color_med_atl[3],
color_med_atl[4]))
p2<-p
data_varpop=data.frame(PC=factor(paste("P",seq(1,10),sep=""),levels=paste("P",seq(1,10),sep="")),VAR=pca$varprop[1:10])
pp<-ggplot(data_varpop,aes(x=PC,y=VAR))+
geom_bar(stat='identity',fill="dodgerblue2",alpha=0.25)+
theme_classic()+
xlab("Principal Component")+
ylab("Variation explained (%)")
```
```{r}
subplot(ggplotly(p1)%>% layout(legend = list(orientation = "h", x = 0.2, y =-0.15)), ggplotly(p2)%>%hide_legend(), ggplotly(pp)%>%hide_legend(), titleX=T,titleY=T,margin=0.035,widths=c(0.375,0.425,0.2),which_layout=1) %>% partial_bundle()
```
### maf = 0.50
```{r}
pca=PCA_list$Prune_filtered$maf0.5[[1]]
data_pca=data.frame(INDIV=pca$sample.id,
PC1=pca$eigenvect[,1],
PC2=pca$eigenvect[,2],
PC3=pca$eigenvect[,3],
PC4=pca$eigenvect[,4],
LOCA=c(rep("Algarve",5),
rep("Bay of Biscay",5),
rep("Gulf of Lion",5),
rep("Costa Calida",5)))
color_med_atl=rev(brewer.pal(n=4,name="RdBu"))
p<-ggplot(data=data_pca,aes(x=PC1,y=PC2,label=INDIV))+
theme_minimal()+
theme(panel.grid=element_blank(),
panel.border=element_rect(fill="transparent"),
plot.title=element_text(hjust=0.5))+
geom_hline(yintercept=0,lty=2)+
geom_vline(xintercept=0,lty=2)+
geom_point(size=3,aes(col=LOCA))+
xlab(paste("PCA 1 (",round(pca$varprop[1]*100,2),"% )",sep=""))+
ylab(paste("PCA 2 (",round(pca$varprop[2]*100,2),"% )",sep=""))+
scale_colour_manual(name="Location",
values=c(color_med_atl[2],
color_med_atl[1],
color_med_atl[3],
color_med_atl[4]))
p1<-p
p<-ggplot(data=data_pca,aes(x=PC3,y=PC4,label=INDIV))+
theme_minimal()+
theme(panel.grid=element_blank(),
panel.border=element_rect(fill="transparent"),
plot.title=element_text(hjust=0.5))+
geom_hline(yintercept=0,lty=2)+
geom_vline(xintercept=0,lty=2)+
geom_point(size=3,aes(col=LOCA))+
xlab(paste("PCA 3 (",round(pca$varprop[3]*100,2),"% )",sep=""))+
ylab(paste("PCA 4 (",round(pca$varprop[4]*100,2),"% )",sep=""))+
scale_colour_manual(name="Location",
values=c(color_med_atl[2],
color_med_atl[1],
color_med_atl[3],
color_med_atl[4]))
p2<-p
data_varpop=data.frame(PC=factor(paste("P",seq(1,10),sep=""),levels=paste("P",seq(1,10),sep="")),VAR=pca$varprop[1:10])
pp<-ggplot(data_varpop,aes(x=PC,y=VAR))+
geom_bar(stat='identity',fill="dodgerblue2",alpha=0.25)+
theme_classic()+
xlab("Principal Component")+
ylab("Variation explained (%)")
```
```{r}
subplot(ggplotly(p1)%>% layout(legend = list(orientation = "h", x = 0.2, y =-0.15)), ggplotly(p2)%>%hide_legend(), ggplotly(pp)%>%hide_legend(), titleX=T,titleY=T,margin=0.035,widths=c(0.375,0.425,0.2),which_layout=1) %>% partial_bundle()
```
Row {.tabset data-height=50}
-----------------------
<center>
<font size="6">**All unfiltered SNPS**</font>
</center>
Row {.tabset data-height=600}
-----------------------
### maf = 0
```{r}
pca=PCA_list$All_unfiltered$maf0[[1]]
data_pca=data.frame(INDIV=pca$sample.id,
PC1=pca$eigenvect[,1],
PC2=pca$eigenvect[,2],
PC3=pca$eigenvect[,3],
PC4=pca$eigenvect[,4],
LOCA=c(rep("Algarve",5),
rep("Bay of Biscay",5),
rep("Gulf of Lion",5),
rep("Costa Calida",5)))
color_med_atl=rev(brewer.pal(n=4,name="RdBu"))
p<-ggplot(data=data_pca,aes(x=PC1,y=PC2,label=INDIV))+
theme_minimal()+
theme(panel.grid=element_blank(),
panel.border=element_rect(fill="transparent"),
plot.title=element_text(hjust=0.5))+
geom_hline(yintercept=0,lty=2)+
geom_vline(xintercept=0,lty=2)+
geom_point(size=3,aes(col=LOCA))+
xlab(paste("PCA 1 (",round(pca$varprop[1]*100,2),"% )",sep=""))+
ylab(paste("PCA 2 (",round(pca$varprop[2]*100,2),"% )",sep=""))+
scale_colour_manual(name="Location",
values=c(color_med_atl[2],
color_med_atl[1],
color_med_atl[3],
color_med_atl[4]))
p1<-p
p<-ggplot(data=data_pca,aes(x=PC3,y=PC4,label=INDIV))+
theme_minimal()+
theme(panel.grid=element_blank(),
panel.border=element_rect(fill="transparent"),
plot.title=element_text(hjust=0.5))+
geom_hline(yintercept=0,lty=2)+
geom_vline(xintercept=0,lty=2)+
geom_point(size=3,aes(col=LOCA))+
xlab(paste("PCA 3 (",round(pca$varprop[3]*100,2),"% )",sep=""))+
ylab(paste("PCA 4 (",round(pca$varprop[4]*100,2),"% )",sep=""))+
scale_colour_manual(name="Location",
values=c(color_med_atl[2],
color_med_atl[1],
color_med_atl[3],
color_med_atl[4]))
p2<-p
data_varpop=data.frame(PC=factor(paste("P",seq(1,10),sep=""),levels=paste("P",seq(1,10),sep="")),VAR=pca$varprop[1:10])
pp<-ggplot(data_varpop,aes(x=PC,y=VAR))+
geom_bar(stat='identity',fill="dodgerblue2",alpha=0.25)+
theme_classic()+
xlab("Principal Component")+
ylab("Variation explained (%)")
```
```{r}
subplot(ggplotly(p1)%>% layout(legend = list(orientation = "h", x = 0.2, y =-0.15)), ggplotly(p2)%>%hide_legend(), ggplotly(pp)%>%hide_legend(), titleX=T,titleY=T,margin=0.035,widths=c(0.375,0.425,0.2),which_layout=1) %>% partial_bundle()
```
### maf = 0.05
```{r}
pca=PCA_list$All_unfiltered$maf0.05[[1]]
data_pca=data.frame(INDIV=pca$sample.id,
PC1=pca$eigenvect[,1],
PC2=pca$eigenvect[,2],
PC3=pca$eigenvect[,3],
PC4=pca$eigenvect[,4],
LOCA=c(rep("Algarve",5),
rep("Bay of Biscay",5),
rep("Gulf of Lion",5),
rep("Costa Calida",5)))
color_med_atl=rev(brewer.pal(n=4,name="RdBu"))
p<-ggplot(data=data_pca,aes(x=PC1,y=PC2,label=INDIV))+
theme_minimal()+
theme(panel.grid=element_blank(),
panel.border=element_rect(fill="transparent"),
plot.title=element_text(hjust=0.5))+
geom_hline(yintercept=0,lty=2)+
geom_vline(xintercept=0,lty=2)+
geom_point(size=3,aes(col=LOCA))+
xlab(paste("PCA 1 (",round(pca$varprop[1]*100,2),"% )",sep=""))+
ylab(paste("PCA 2 (",round(pca$varprop[2]*100,2),"% )",sep=""))+
scale_colour_manual(name="Location",
values=c(color_med_atl[2],
color_med_atl[1],
color_med_atl[3],
color_med_atl[4]))
p1<-p
p<-ggplot(data=data_pca,aes(x=PC3,y=PC4,label=INDIV))+
theme_minimal()+
theme(panel.grid=element_blank(),
panel.border=element_rect(fill="transparent"),
plot.title=element_text(hjust=0.5))+
geom_hline(yintercept=0,lty=2)+
geom_vline(xintercept=0,lty=2)+
geom_point(size=3,aes(col=LOCA))+
xlab(paste("PCA 3 (",round(pca$varprop[3]*100,2),"% )",sep=""))+
ylab(paste("PCA 4 (",round(pca$varprop[4]*100,2),"% )",sep=""))+
scale_colour_manual(name="Location",
values=c(color_med_atl[2],
color_med_atl[1],
color_med_atl[3],
color_med_atl[4]))
p2<-p
data_varpop=data.frame(PC=factor(paste("P",seq(1,10),sep=""),levels=paste("P",seq(1,10),sep="")),VAR=pca$varprop[1:10])
pp<-ggplot(data_varpop,aes(x=PC,y=VAR))+
geom_bar(stat='identity',fill="dodgerblue2",alpha=0.25)+
theme_classic()+
xlab("Principal Component")+
ylab("Variation explained (%)")
```
```{r}
subplot(ggplotly(p1)%>% layout(legend = list(orientation = "h", x = 0.2, y =-0.15)), ggplotly(p2)%>%hide_legend(), ggplotly(pp)%>%hide_legend(), titleX=T,titleY=T,margin=0.035,widths=c(0.375,0.425,0.2),which_layout=1) %>% partial_bundle()
```
### maf = 0.1
```{r}
pca=PCA_list$All_unfiltered$maf0.1[[1]]
data_pca=data.frame(INDIV=pca$sample.id,
PC1=pca$eigenvect[,1],
PC2=pca$eigenvect[,2],
PC3=pca$eigenvect[,3],
PC4=pca$eigenvect[,4],
LOCA=c(rep("Algarve",5),
rep("Bay of Biscay",5),
rep("Gulf of Lion",5),
rep("Costa Calida",5)))
color_med_atl=rev(brewer.pal(n=4,name="RdBu"))
p<-ggplot(data=data_pca,aes(x=PC1,y=PC2,label=INDIV))+
theme_minimal()+
theme(panel.grid=element_blank(),
panel.border=element_rect(fill="transparent"),
plot.title=element_text(hjust=0.5))+
geom_hline(yintercept=0,lty=2)+
geom_vline(xintercept=0,lty=2)+
geom_point(size=3,aes(col=LOCA))+
xlab(paste("PCA 1 (",round(pca$varprop[1]*100,2),"% )",sep=""))+
ylab(paste("PCA 2 (",round(pca$varprop[2]*100,2),"% )",sep=""))+
scale_colour_manual(name="Location",
values=c(color_med_atl[2],
color_med_atl[1],
color_med_atl[3],
color_med_atl[4]))
p1<-p
p<-ggplot(data=data_pca,aes(x=PC3,y=PC4,label=INDIV))+
theme_minimal()+
theme(panel.grid=element_blank(),
panel.border=element_rect(fill="transparent"),
plot.title=element_text(hjust=0.5))+
geom_hline(yintercept=0,lty=2)+
geom_vline(xintercept=0,lty=2)+
geom_point(size=3,aes(col=LOCA))+
xlab(paste("PCA 3 (",round(pca$varprop[3]*100,2),"% )",sep=""))+
ylab(paste("PCA 4 (",round(pca$varprop[4]*100,2),"% )",sep=""))+
scale_colour_manual(name="Location",
values=c(color_med_atl[2],
color_med_atl[1],
color_med_atl[3],
color_med_atl[4]))
p2<-p
data_varpop=data.frame(PC=factor(paste("P",seq(1,10),sep=""),levels=paste("P",seq(1,10),sep="")),VAR=pca$varprop[1:10])
pp<-ggplot(data_varpop,aes(x=PC,y=VAR))+
geom_bar(stat='identity',fill="dodgerblue2",alpha=0.25)+
theme_classic()+
xlab("Principal Component")+
ylab("Variation explained (%)")
```
```{r}
subplot(ggplotly(p1)%>% layout(legend = list(orientation = "h", x = 0.2, y =-0.15)), ggplotly(p2)%>%hide_legend(), ggplotly(pp)%>%hide_legend(), titleX=T,titleY=T,margin=0.035,widths=c(0.375,0.425,0.2),which_layout=1) %>% partial_bundle()
```
### maf = 0.15
```{r}
pca=PCA_list$All_unfiltered$maf0.15[[1]]
data_pca=data.frame(INDIV=pca$sample.id,
PC1=pca$eigenvect[,1],
PC2=pca$eigenvect[,2],
PC3=pca$eigenvect[,3],
PC4=pca$eigenvect[,4],
LOCA=c(rep("Algarve",5),
rep("Bay of Biscay",5),
rep("Gulf of Lion",5),
rep("Costa Calida",5)))
color_med_atl=rev(brewer.pal(n=4,name="RdBu"))
p<-ggplot(data=data_pca,aes(x=PC1,y=PC2,label=INDIV))+
theme_minimal()+
theme(panel.grid=element_blank(),
panel.border=element_rect(fill="transparent"),
plot.title=element_text(hjust=0.5))+
geom_hline(yintercept=0,lty=2)+
geom_vline(xintercept=0,lty=2)+
geom_point(size=3,aes(col=LOCA))+
xlab(paste("PCA 1 (",round(pca$varprop[1]*100,2),"% )",sep=""))+
ylab(paste("PCA 2 (",round(pca$varprop[2]*100,2),"% )",sep=""))+
scale_colour_manual(name="Location",
values=c(color_med_atl[2],
color_med_atl[1],
color_med_atl[3],
color_med_atl[4]))
p1<-p
p<-ggplot(data=data_pca,aes(x=PC3,y=PC4,label=INDIV))+
theme_minimal()+
theme(panel.grid=element_blank(),
panel.border=element_rect(fill="transparent"),
plot.title=element_text(hjust=0.5))+
geom_hline(yintercept=0,lty=2)+
geom_vline(xintercept=0,lty=2)+
geom_point(size=3,aes(col=LOCA))+
xlab(paste("PCA 3 (",round(pca$varprop[3]*100,2),"% )",sep=""))+
ylab(paste("PCA 4 (",round(pca$varprop[4]*100,2),"% )",sep=""))+
scale_colour_manual(name="Location",
values=c(color_med_atl[2],
color_med_atl[1],
color_med_atl[3],
color_med_atl[4]))
p2<-p
data_varpop=data.frame(PC=factor(paste("P",seq(1,10),sep=""),levels=paste("P",seq(1,10),sep="")),VAR=pca$varprop[1:10])
pp<-ggplot(data_varpop,aes(x=PC,y=VAR))+
geom_bar(stat='identity',fill="dodgerblue2",alpha=0.25)+
theme_classic()+
xlab("Principal Component")+
ylab("Variation explained (%)")
```
```{r}
subplot(ggplotly(p1)%>% layout(legend = list(orientation = "h", x = 0.2, y =-0.15)), ggplotly(p2)%>%hide_legend(), ggplotly(pp)%>%hide_legend(), titleX=T,titleY=T,margin=0.035,widths=c(0.375,0.425,0.2),which_layout=1) %>% partial_bundle()
```
### maf = 0.20
```{r}
pca=PCA_list$All_unfiltered$maf0.2[[1]]
data_pca=data.frame(INDIV=pca$sample.id,
PC1=pca$eigenvect[,1],
PC2=pca$eigenvect[,2],
PC3=pca$eigenvect[,3],
PC4=pca$eigenvect[,4],
LOCA=c(rep("Algarve",5),
rep("Bay of Biscay",5),
rep("Gulf of Lion",5),
rep("Costa Calida",5)))
color_med_atl=rev(brewer.pal(n=4,name="RdBu"))
p<-ggplot(data=data_pca,aes(x=PC1,y=PC2,label=INDIV))+
theme_minimal()+
theme(panel.grid=element_blank(),
panel.border=element_rect(fill="transparent"),
plot.title=element_text(hjust=0.5))+
geom_hline(yintercept=0,lty=2)+
geom_vline(xintercept=0,lty=2)+
geom_point(size=3,aes(col=LOCA))+
xlab(paste("PCA 1 (",round(pca$varprop[1]*100,2),"% )",sep=""))+
ylab(paste("PCA 2 (",round(pca$varprop[2]*100,2),"% )",sep=""))+
scale_colour_manual(name="Location",
values=c(color_med_atl[2],
color_med_atl[1],
color_med_atl[3],
color_med_atl[4]))
p1<-p
p<-ggplot(data=data_pca,aes(x=PC3,y=PC4,label=INDIV))+
theme_minimal()+
theme(panel.grid=element_blank(),
panel.border=element_rect(fill="transparent"),
plot.title=element_text(hjust=0.5))+
geom_hline(yintercept=0,lty=2)+
geom_vline(xintercept=0,lty=2)+
geom_point(size=3,aes(col=LOCA))+
xlab(paste("PCA 3 (",round(pca$varprop[3]*100,2),"% )",sep=""))+
ylab(paste("PCA 4 (",round(pca$varprop[4]*100,2),"% )",sep=""))+
scale_colour_manual(name="Location",
values=c(color_med_atl[2],
color_med_atl[1],
color_med_atl[3],
color_med_atl[4]))
p2<-p
data_varpop=data.frame(PC=factor(paste("P",seq(1,10),sep=""),levels=paste("P",seq(1,10),sep="")),VAR=pca$varprop[1:10])
pp<-ggplot(data_varpop,aes(x=PC,y=VAR))+
geom_bar(stat='identity',fill="dodgerblue2",alpha=0.25)+
theme_classic()+
xlab("Principal Component")+
ylab("Variation explained (%)")
```
```{r}
subplot(ggplotly(p1)%>% layout(legend = list(orientation = "h", x = 0.2, y =-0.15)), ggplotly(p2)%>%hide_legend(), ggplotly(pp)%>%hide_legend(), titleX=T,titleY=T,margin=0.035,widths=c(0.375,0.425,0.2),which_layout=1) %>% partial_bundle()
```
### maf = 0.25
```{r}
pca=PCA_list$All_unfiltered$maf0.25[[1]]
data_pca=data.frame(INDIV=pca$sample.id,
PC1=pca$eigenvect[,1],
PC2=pca$eigenvect[,2],
PC3=pca$eigenvect[,3],
PC4=pca$eigenvect[,4],
LOCA=c(rep("Algarve",5),
rep("Bay of Biscay",5),
rep("Gulf of Lion",5),
rep("Costa Calida",5)))
color_med_atl=rev(brewer.pal(n=4,name="RdBu"))
p<-ggplot(data=data_pca,aes(x=PC1,y=PC2,label=INDIV))+
theme_minimal()+
theme(panel.grid=element_blank(),
panel.border=element_rect(fill="transparent"),
plot.title=element_text(hjust=0.5))+
geom_hline(yintercept=0,lty=2)+
geom_vline(xintercept=0,lty=2)+
geom_point(size=3,aes(col=LOCA))+
xlab(paste("PCA 1 (",round(pca$varprop[1]*100,2),"% )",sep=""))+
ylab(paste("PCA 2 (",round(pca$varprop[2]*100,2),"% )",sep=""))+
scale_colour_manual(name="Location",
values=c(color_med_atl[2],
color_med_atl[1],
color_med_atl[3],
color_med_atl[4]))
p1<-p
p<-ggplot(data=data_pca,aes(x=PC3,y=PC4,label=INDIV))+
theme_minimal()+
theme(panel.grid=element_blank(),
panel.border=element_rect(fill="transparent"),
plot.title=element_text(hjust=0.5))+
geom_hline(yintercept=0,lty=2)+
geom_vline(xintercept=0,lty=2)+
geom_point(size=3,aes(col=LOCA))+
xlab(paste("PCA 3 (",round(pca$varprop[3]*100,2),"% )",sep=""))+
ylab(paste("PCA 4 (",round(pca$varprop[4]*100,2),"% )",sep=""))+
scale_colour_manual(name="Location",
values=c(color_med_atl[2],
color_med_atl[1],
color_med_atl[3],
color_med_atl[4]))
p2<-p
data_varpop=data.frame(PC=factor(paste("P",seq(1,10),sep=""),levels=paste("P",seq(1,10),sep="")),VAR=pca$varprop[1:10])
pp<-ggplot(data_varpop,aes(x=PC,y=VAR))+
geom_bar(stat='identity',fill="dodgerblue2",alpha=0.25)+
theme_classic()+
xlab("Principal Component")+
ylab("Variation explained (%)")
```
```{r}
subplot(ggplotly(p1)%>% layout(legend = list(orientation = "h", x = 0.2, y =-0.15)), ggplotly(p2)%>%hide_legend(), ggplotly(pp)%>%hide_legend(), titleX=T,titleY=T,margin=0.035,widths=c(0.375,0.425,0.2),which_layout=1) %>% partial_bundle()
```
### maf = 0.30
```{r}
pca=PCA_list$All_unfiltered$maf0.3[[1]]
data_pca=data.frame(INDIV=pca$sample.id,
PC1=pca$eigenvect[,1],
PC2=pca$eigenvect[,2],
PC3=pca$eigenvect[,3],
PC4=pca$eigenvect[,4],
LOCA=c(rep("Algarve",5),
rep("Bay of Biscay",5),
rep("Gulf of Lion",5),
rep("Costa Calida",5)))
color_med_atl=rev(brewer.pal(n=4,name="RdBu"))
p<-ggplot(data=data_pca,aes(x=PC1,y=PC2,label=INDIV))+
theme_minimal()+
theme(panel.grid=element_blank(),
panel.border=element_rect(fill="transparent"),
plot.title=element_text(hjust=0.5))+
geom_hline(yintercept=0,lty=2)+
geom_vline(xintercept=0,lty=2)+
geom_point(size=3,aes(col=LOCA))+
xlab(paste("PCA 1 (",round(pca$varprop[1]*100,2),"% )",sep=""))+
ylab(paste("PCA 2 (",round(pca$varprop[2]*100,2),"% )",sep=""))+
scale_colour_manual(name="Location",
values=c(color_med_atl[2],
color_med_atl[1],
color_med_atl[3],
color_med_atl[4]))
p1<-p
p<-ggplot(data=data_pca,aes(x=PC3,y=PC4,label=INDIV))+
theme_minimal()+
theme(panel.grid=element_blank(),
panel.border=element_rect(fill="transparent"),
plot.title=element_text(hjust=0.5))+
geom_hline(yintercept=0,lty=2)+
geom_vline(xintercept=0,lty=2)+
geom_point(size=3,aes(col=LOCA))+
xlab(paste("PCA 3 (",round(pca$varprop[3]*100,2),"% )",sep=""))+
ylab(paste("PCA 4 (",round(pca$varprop[4]*100,2),"% )",sep=""))+
scale_colour_manual(name="Location",
values=c(color_med_atl[2],
color_med_atl[1],
color_med_atl[3],
color_med_atl[4]))
p2<-p
data_varpop=data.frame(PC=factor(paste("P",seq(1,10),sep=""),levels=paste("P",seq(1,10),sep="")),VAR=pca$varprop[1:10])
pp<-ggplot(data_varpop,aes(x=PC,y=VAR))+
geom_bar(stat='identity',fill="dodgerblue2",alpha=0.25)+
theme_classic()+
xlab("Principal Component")+
ylab("Variation explained (%)")
```
```{r}
subplot(ggplotly(p1)%>% layout(legend = list(orientation = "h", x = 0.2, y =-0.15)), ggplotly(p2)%>%hide_legend(), ggplotly(pp)%>%hide_legend(), titleX=T,titleY=T,margin=0.035,widths=c(0.375,0.425,0.2),which_layout=1) %>% partial_bundle()
```
### maf = 0.35
```{r}
pca=PCA_list$All_unfiltered$maf0.35[[1]]
data_pca=data.frame(INDIV=pca$sample.id,
PC1=pca$eigenvect[,1],
PC2=pca$eigenvect[,2],
PC3=pca$eigenvect[,3],
PC4=pca$eigenvect[,4],
LOCA=c(rep("Algarve",5),
rep("Bay of Biscay",5),
rep("Gulf of Lion",5),
rep("Costa Calida",5)))
color_med_atl=rev(brewer.pal(n=4,name="RdBu"))
p<-ggplot(data=data_pca,aes(x=PC1,y=PC2,label=INDIV))+
theme_minimal()+
theme(panel.grid=element_blank(),
panel.border=element_rect(fill="transparent"),
plot.title=element_text(hjust=0.5))+
geom_hline(yintercept=0,lty=2)+
geom_vline(xintercept=0,lty=2)+
geom_point(size=3,aes(col=LOCA))+
xlab(paste("PCA 1 (",round(pca$varprop[1]*100,2),"% )",sep=""))+
ylab(paste("PCA 2 (",round(pca$varprop[2]*100,2),"% )",sep=""))+
scale_colour_manual(name="Location",
values=c(color_med_atl[2],
color_med_atl[1],
color_med_atl[3],
color_med_atl[4]))
p1<-p
p<-ggplot(data=data_pca,aes(x=PC3,y=PC4,label=INDIV))+
theme_minimal()+
theme(panel.grid=element_blank(),
panel.border=element_rect(fill="transparent"),
plot.title=element_text(hjust=0.5))+
geom_hline(yintercept=0,lty=2)+
geom_vline(xintercept=0,lty=2)+
geom_point(size=3,aes(col=LOCA))+
xlab(paste("PCA 3 (",round(pca$varprop[3]*100,2),"% )",sep=""))+
ylab(paste("PCA 4 (",round(pca$varprop[4]*100,2),"% )",sep=""))+
scale_colour_manual(name="Location",
values=c(color_med_atl[2],
color_med_atl[1],
color_med_atl[3],
color_med_atl[4]))
p2<-p
data_varpop=data.frame(PC=factor(paste("P",seq(1,10),sep=""),levels=paste("P",seq(1,10),sep="")),VAR=pca$varprop[1:10])
pp<-ggplot(data_varpop,aes(x=PC,y=VAR))+
geom_bar(stat='identity',fill="dodgerblue2",alpha=0.25)+
theme_classic()+
xlab("Principal Component")+
ylab("Variation explained (%)")
```
```{r}
subplot(ggplotly(p1)%>% layout(legend = list(orientation = "h", x = 0.2, y =-0.15)), ggplotly(p2)%>%hide_legend(), ggplotly(pp)%>%hide_legend(), titleX=T,titleY=T,margin=0.035,widths=c(0.375,0.425,0.2),which_layout=1) %>% partial_bundle()
```
### maf = 0.40
```{r}
pca=PCA_list$All_unfiltered$maf0.4[[1]]
data_pca=data.frame(INDIV=pca$sample.id,
PC1=pca$eigenvect[,1],
PC2=pca$eigenvect[,2],
PC3=pca$eigenvect[,3],
PC4=pca$eigenvect[,4],
LOCA=c(rep("Algarve",5),
rep("Bay of Biscay",5),
rep("Gulf of Lion",5),
rep("Costa Calida",5)))
color_med_atl=rev(brewer.pal(n=4,name="RdBu"))
p<-ggplot(data=data_pca,aes(x=PC1,y=PC2,label=INDIV))+
theme_minimal()+
theme(panel.grid=element_blank(),
panel.border=element_rect(fill="transparent"),
plot.title=element_text(hjust=0.5))+
geom_hline(yintercept=0,lty=2)+
geom_vline(xintercept=0,lty=2)+
geom_point(size=3,aes(col=LOCA))+
xlab(paste("PCA 1 (",round(pca$varprop[1]*100,2),"% )",sep=""))+
ylab(paste("PCA 2 (",round(pca$varprop[2]*100,2),"% )",sep=""))+
scale_colour_manual(name="Location",
values=c(color_med_atl[2],
color_med_atl[1],
color_med_atl[3],
color_med_atl[4]))
p1<-p
p<-ggplot(data=data_pca,aes(x=PC3,y=PC4,label=INDIV))+
theme_minimal()+
theme(panel.grid=element_blank(),
panel.border=element_rect(fill="transparent"),
plot.title=element_text(hjust=0.5))+
geom_hline(yintercept=0,lty=2)+
geom_vline(xintercept=0,lty=2)+
geom_point(size=3,aes(col=LOCA))+
xlab(paste("PCA 3 (",round(pca$varprop[3]*100,2),"% )",sep=""))+
ylab(paste("PCA 4 (",round(pca$varprop[4]*100,2),"% )",sep=""))+
scale_colour_manual(name="Location",
values=c(color_med_atl[2],
color_med_atl[1],
color_med_atl[3],
color_med_atl[4]))
p2<-p
data_varpop=data.frame(PC=factor(paste("P",seq(1,10),sep=""),levels=paste("P",seq(1,10),sep="")),VAR=pca$varprop[1:10])
pp<-ggplot(data_varpop,aes(x=PC,y=VAR))+
geom_bar(stat='identity',fill="dodgerblue2",alpha=0.25)+
theme_classic()+
xlab("Principal Component")+
ylab("Variation explained (%)")
```
```{r}
subplot(ggplotly(p1)%>% layout(legend = list(orientation = "h", x = 0.2, y =-0.15)), ggplotly(p2)%>%hide_legend(), ggplotly(pp)%>%hide_legend(), titleX=T,titleY=T,margin=0.035,widths=c(0.375,0.425,0.2),which_layout=1) %>% partial_bundle()
```
### maf = 0.45
```{r}
pca=PCA_list$All_unfiltered$maf0.45[[1]]
data_pca=data.frame(INDIV=pca$sample.id,
PC1=pca$eigenvect[,1],
PC2=pca$eigenvect[,2],
PC3=pca$eigenvect[,3],
PC4=pca$eigenvect[,4],
LOCA=c(rep("Algarve",5),
rep("Bay of Biscay",5),
rep("Gulf of Lion",5),
rep("Costa Calida",5)))
color_med_atl=rev(brewer.pal(n=4,name="RdBu"))
p<-ggplot(data=data_pca,aes(x=PC1,y=PC2,label=INDIV))+
theme_minimal()+
theme(panel.grid=element_blank(),
panel.border=element_rect(fill="transparent"),
plot.title=element_text(hjust=0.5))+
geom_hline(yintercept=0,lty=2)+
geom_vline(xintercept=0,lty=2)+
geom_point(size=3,aes(col=LOCA))+
xlab(paste("PCA 1 (",round(pca$varprop[1]*100,2),"% )",sep=""))+
ylab(paste("PCA 2 (",round(pca$varprop[2]*100,2),"% )",sep=""))+
scale_colour_manual(name="Location",
values=c(color_med_atl[2],
color_med_atl[1],
color_med_atl[3],
color_med_atl[4]))
p1<-p
p<-ggplot(data=data_pca,aes(x=PC3,y=PC4,label=INDIV))+
theme_minimal()+
theme(panel.grid=element_blank(),
panel.border=element_rect(fill="transparent"),
plot.title=element_text(hjust=0.5))+
geom_hline(yintercept=0,lty=2)+
geom_vline(xintercept=0,lty=2)+
geom_point(size=3,aes(col=LOCA))+
xlab(paste("PCA 3 (",round(pca$varprop[3]*100,2),"% )",sep=""))+
ylab(paste("PCA 4 (",round(pca$varprop[4]*100,2),"% )",sep=""))+
scale_colour_manual(name="Location",
values=c(color_med_atl[2],
color_med_atl[1],
color_med_atl[3],
color_med_atl[4]))
p2<-p
data_varpop=data.frame(PC=factor(paste("P",seq(1,10),sep=""),levels=paste("P",seq(1,10),sep="")),VAR=pca$varprop[1:10])
pp<-ggplot(data_varpop,aes(x=PC,y=VAR))+
geom_bar(stat='identity',fill="dodgerblue2",alpha=0.25)+
theme_classic()+
xlab("Principal Component")+
ylab("Variation explained (%)")
```
```{r}
subplot(ggplotly(p1)%>% layout(legend = list(orientation = "h", x = 0.2, y =-0.15)), ggplotly(p2)%>%hide_legend(), ggplotly(pp)%>%hide_legend(), titleX=T,titleY=T,margin=0.035,widths=c(0.375,0.425,0.2),which_layout=1) %>% partial_bundle()
```
### maf = 0.50
```{r}
pca=PCA_list$All_unfiltered$maf0.5[[1]]
data_pca=data.frame(INDIV=pca$sample.id,
PC1=pca$eigenvect[,1],
PC2=pca$eigenvect[,2],
PC3=pca$eigenvect[,3],
PC4=pca$eigenvect[,4],
LOCA=c(rep("Algarve",5),
rep("Bay of Biscay",5),
rep("Gulf of Lion",5),
rep("Costa Calida",5)))
color_med_atl=rev(brewer.pal(n=4,name="RdBu"))
p<-ggplot(data=data_pca,aes(x=PC1,y=PC2,label=INDIV))+
theme_minimal()+
theme(panel.grid=element_blank(),
panel.border=element_rect(fill="transparent"),
plot.title=element_text(hjust=0.5))+
geom_hline(yintercept=0,lty=2)+
geom_vline(xintercept=0,lty=2)+
geom_point(size=3,aes(col=LOCA))+
xlab(paste("PCA 1 (",round(pca$varprop[1]*100,2),"% )",sep=""))+
ylab(paste("PCA 2 (",round(pca$varprop[2]*100,2),"% )",sep=""))+
scale_colour_manual(name="Location",
values=c(color_med_atl[2],
color_med_atl[1],
color_med_atl[3],
color_med_atl[4]))
p1<-p
p<-ggplot(data=data_pca,aes(x=PC3,y=PC4,label=INDIV))+
theme_minimal()+
theme(panel.grid=element_blank(),
panel.border=element_rect(fill="transparent"),
plot.title=element_text(hjust=0.5))+
geom_hline(yintercept=0,lty=2)+
geom_vline(xintercept=0,lty=2)+
geom_point(size=3,aes(col=LOCA))+
xlab(paste("PCA 3 (",round(pca$varprop[3]*100,2),"% )",sep=""))+
ylab(paste("PCA 4 (",round(pca$varprop[4]*100,2),"% )",sep=""))+
scale_colour_manual(name="Location",
values=c(color_med_atl[2],
color_med_atl[1],
color_med_atl[3],
color_med_atl[4]))
p2<-p
data_varpop=data.frame(PC=factor(paste("P",seq(1,10),sep=""),levels=paste("P",seq(1,10),sep="")),VAR=pca$varprop[1:10])
pp<-ggplot(data_varpop,aes(x=PC,y=VAR))+
geom_bar(stat='identity',fill="dodgerblue2",alpha=0.25)+
theme_classic()+
xlab("Principal Component")+
ylab("Variation explained (%)")
```
```{r}
subplot(ggplotly(p1)%>% layout(legend = list(orientation = "h", x = 0.2, y =-0.15)), ggplotly(p2)%>%hide_legend(), ggplotly(pp)%>%hide_legend(), titleX=T,titleY=T,margin=0.035,widths=c(0.375,0.425,0.2),which_layout=1) %>% partial_bundle()
```
Row {.tabset data-height=50}
-----------------------
<center>
<font size="6">**Pruned unfiltered SNPS**</font>
</center>
Row {.tabset data-height=600}
-----------------------
### maf = 0
```{r}
pca=PCA_list$Prune_unfiltered$maf0[[1]]
data_pca=data.frame(INDIV=pca$sample.id,
PC1=pca$eigenvect[,1],
PC2=pca$eigenvect[,2],
PC3=pca$eigenvect[,3],
PC4=pca$eigenvect[,4],
LOCA=c(rep("Algarve",5),
rep("Bay of Biscay",5),
rep("Gulf of Lion",5),
rep("Costa Calida",5)))
color_med_atl=rev(brewer.pal(n=4,name="RdBu"))
p<-ggplot(data=data_pca,aes(x=PC1,y=PC2,label=INDIV))+
theme_minimal()+
theme(panel.grid=element_blank(),
panel.border=element_rect(fill="transparent"),
plot.title=element_text(hjust=0.5))+
geom_hline(yintercept=0,lty=2)+
geom_vline(xintercept=0,lty=2)+
geom_point(size=3,aes(col=LOCA))+
xlab(paste("PCA 1 (",round(pca$varprop[1]*100,2),"% )",sep=""))+
ylab(paste("PCA 2 (",round(pca$varprop[2]*100,2),"% )",sep=""))+
scale_colour_manual(name="Location",
values=c(color_med_atl[2],
color_med_atl[1],
color_med_atl[3],
color_med_atl[4]))
p1<-p
p<-ggplot(data=data_pca,aes(x=PC3,y=PC4,label=INDIV))+
theme_minimal()+
theme(panel.grid=element_blank(),
panel.border=element_rect(fill="transparent"),
plot.title=element_text(hjust=0.5))+
geom_hline(yintercept=0,lty=2)+
geom_vline(xintercept=0,lty=2)+
geom_point(size=3,aes(col=LOCA))+
xlab(paste("PCA 3 (",round(pca$varprop[3]*100,2),"% )",sep=""))+
ylab(paste("PCA 4 (",round(pca$varprop[4]*100,2),"% )",sep=""))+
scale_colour_manual(name="Location",
values=c(color_med_atl[2],
color_med_atl[1],
color_med_atl[3],
color_med_atl[4]))
p2<-p
data_varpop=data.frame(PC=factor(paste("P",seq(1,10),sep=""),levels=paste("P",seq(1,10),sep="")),VAR=pca$varprop[1:10])
pp<-ggplot(data_varpop,aes(x=PC,y=VAR))+
geom_bar(stat='identity',fill="dodgerblue2",alpha=0.25)+
theme_classic()+
xlab("Principal Component")+
ylab("Variation explained (%)")
```
```{r}
subplot(ggplotly(p1)%>% layout(legend = list(orientation = "h", x = 0.2, y =-0.15)), ggplotly(p2)%>%hide_legend(), ggplotly(pp)%>%hide_legend(), titleX=T,titleY=T,margin=0.035,widths=c(0.375,0.425,0.2),which_layout=1) %>% partial_bundle()
```
### maf = 0.05
```{r}
pca=PCA_list$Prune_unfiltered$maf0.05[[1]]
data_pca=data.frame(INDIV=pca$sample.id,
PC1=pca$eigenvect[,1],
PC2=pca$eigenvect[,2],
PC3=pca$eigenvect[,3],
PC4=pca$eigenvect[,4],
LOCA=c(rep("Algarve",5),
rep("Bay of Biscay",5),
rep("Gulf of Lion",5),
rep("Costa Calida",5)))
color_med_atl=rev(brewer.pal(n=4,name="RdBu"))
p<-ggplot(data=data_pca,aes(x=PC1,y=PC2,label=INDIV))+
theme_minimal()+
theme(panel.grid=element_blank(),
panel.border=element_rect(fill="transparent"),
plot.title=element_text(hjust=0.5))+
geom_hline(yintercept=0,lty=2)+
geom_vline(xintercept=0,lty=2)+
geom_point(size=3,aes(col=LOCA))+
xlab(paste("PCA 1 (",round(pca$varprop[1]*100,2),"% )",sep=""))+
ylab(paste("PCA 2 (",round(pca$varprop[2]*100,2),"% )",sep=""))+
scale_colour_manual(name="Location",
values=c(color_med_atl[2],
color_med_atl[1],
color_med_atl[3],
color_med_atl[4]))
p1<-p
p<-ggplot(data=data_pca,aes(x=PC3,y=PC4,label=INDIV))+
theme_minimal()+
theme(panel.grid=element_blank(),
panel.border=element_rect(fill="transparent"),
plot.title=element_text(hjust=0.5))+
geom_hline(yintercept=0,lty=2)+
geom_vline(xintercept=0,lty=2)+
geom_point(size=3,aes(col=LOCA))+
xlab(paste("PCA 3 (",round(pca$varprop[3]*100,2),"% )",sep=""))+
ylab(paste("PCA 4 (",round(pca$varprop[4]*100,2),"% )",sep=""))+
scale_colour_manual(name="Location",
values=c(color_med_atl[2],
color_med_atl[1],
color_med_atl[3],
color_med_atl[4]))
p2<-p
data_varpop=data.frame(PC=factor(paste("P",seq(1,10),sep=""),levels=paste("P",seq(1,10),sep="")),VAR=pca$varprop[1:10])
pp<-ggplot(data_varpop,aes(x=PC,y=VAR))+
geom_bar(stat='identity',fill="dodgerblue2",alpha=0.25)+
theme_classic()+
xlab("Principal Component")+
ylab("Variation explained (%)")
```
```{r}
subplot(ggplotly(p1)%>% layout(legend = list(orientation = "h", x = 0.2, y =-0.15)), ggplotly(p2)%>%hide_legend(), ggplotly(pp)%>%hide_legend(), titleX=T,titleY=T,margin=0.035,widths=c(0.375,0.425,0.2),which_layout=1) %>% partial_bundle()
```
### maf = 0.1
```{r}
pca=PCA_list$Prune_unfiltered$maf0.1[[1]]
data_pca=data.frame(INDIV=pca$sample.id,
PC1=pca$eigenvect[,1],
PC2=pca$eigenvect[,2],
PC3=pca$eigenvect[,3],
PC4=pca$eigenvect[,4],
LOCA=c(rep("Algarve",5),
rep("Bay of Biscay",5),
rep("Gulf of Lion",5),
rep("Costa Calida",5)))
color_med_atl=rev(brewer.pal(n=4,name="RdBu"))
p<-ggplot(data=data_pca,aes(x=PC1,y=PC2,label=INDIV))+
theme_minimal()+
theme(panel.grid=element_blank(),
panel.border=element_rect(fill="transparent"),
plot.title=element_text(hjust=0.5))+
geom_hline(yintercept=0,lty=2)+
geom_vline(xintercept=0,lty=2)+
geom_point(size=3,aes(col=LOCA))+
xlab(paste("PCA 1 (",round(pca$varprop[1]*100,2),"% )",sep=""))+
ylab(paste("PCA 2 (",round(pca$varprop[2]*100,2),"% )",sep=""))+
scale_colour_manual(name="Location",
values=c(color_med_atl[2],
color_med_atl[1],
color_med_atl[3],
color_med_atl[4]))
p1<-p
p<-ggplot(data=data_pca,aes(x=PC3,y=PC4,label=INDIV))+
theme_minimal()+
theme(panel.grid=element_blank(),
panel.border=element_rect(fill="transparent"),
plot.title=element_text(hjust=0.5))+
geom_hline(yintercept=0,lty=2)+
geom_vline(xintercept=0,lty=2)+
geom_point(size=3,aes(col=LOCA))+
xlab(paste("PCA 3 (",round(pca$varprop[3]*100,2),"% )",sep=""))+
ylab(paste("PCA 4 (",round(pca$varprop[4]*100,2),"% )",sep=""))+
scale_colour_manual(name="Location",
values=c(color_med_atl[2],
color_med_atl[1],
color_med_atl[3],
color_med_atl[4]))
p2<-p
data_varpop=data.frame(PC=factor(paste("P",seq(1,10),sep=""),levels=paste("P",seq(1,10),sep="")),VAR=pca$varprop[1:10])
pp<-ggplot(data_varpop,aes(x=PC,y=VAR))+
geom_bar(stat='identity',fill="dodgerblue2",alpha=0.25)+
theme_classic()+
xlab("Principal Component")+
ylab("Variation explained (%)")
```
```{r}
subplot(ggplotly(p1)%>% layout(legend = list(orientation = "h", x = 0.2, y =-0.15)), ggplotly(p2)%>%hide_legend(), ggplotly(pp)%>%hide_legend(), titleX=T,titleY=T,margin=0.035,widths=c(0.375,0.425,0.2),which_layout=1) %>% partial_bundle()
```
### maf = 0.15
```{r}
pca=PCA_list$Prune_unfiltered$maf0.15[[1]]
data_pca=data.frame(INDIV=pca$sample.id,
PC1=pca$eigenvect[,1],
PC2=pca$eigenvect[,2],
PC3=pca$eigenvect[,3],
PC4=pca$eigenvect[,4],
LOCA=c(rep("Algarve",5),
rep("Bay of Biscay",5),
rep("Gulf of Lion",5),
rep("Costa Calida",5)))
color_med_atl=rev(brewer.pal(n=4,name="RdBu"))
p<-ggplot(data=data_pca,aes(x=PC1,y=PC2,label=INDIV))+
theme_minimal()+
theme(panel.grid=element_blank(),
panel.border=element_rect(fill="transparent"),
plot.title=element_text(hjust=0.5))+
geom_hline(yintercept=0,lty=2)+
geom_vline(xintercept=0,lty=2)+
geom_point(size=3,aes(col=LOCA))+
xlab(paste("PCA 1 (",round(pca$varprop[1]*100,2),"% )",sep=""))+
ylab(paste("PCA 2 (",round(pca$varprop[2]*100,2),"% )",sep=""))+
scale_colour_manual(name="Location",
values=c(color_med_atl[2],
color_med_atl[1],
color_med_atl[3],
color_med_atl[4]))
p1<-p
p<-ggplot(data=data_pca,aes(x=PC3,y=PC4,label=INDIV))+
theme_minimal()+
theme(panel.grid=element_blank(),
panel.border=element_rect(fill="transparent"),
plot.title=element_text(hjust=0.5))+
geom_hline(yintercept=0,lty=2)+
geom_vline(xintercept=0,lty=2)+
geom_point(size=3,aes(col=LOCA))+
xlab(paste("PCA 3 (",round(pca$varprop[3]*100,2),"% )",sep=""))+
ylab(paste("PCA 4 (",round(pca$varprop[4]*100,2),"% )",sep=""))+
scale_colour_manual(name="Location",
values=c(color_med_atl[2],
color_med_atl[1],
color_med_atl[3],
color_med_atl[4]))
p2<-p
data_varpop=data.frame(PC=factor(paste("P",seq(1,10),sep=""),levels=paste("P",seq(1,10),sep="")),VAR=pca$varprop[1:10])
pp<-ggplot(data_varpop,aes(x=PC,y=VAR))+
geom_bar(stat='identity',fill="dodgerblue2",alpha=0.25)+
theme_classic()+
xlab("Principal Component")+
ylab("Variation explained (%)")
```
```{r}
subplot(ggplotly(p1)%>% layout(legend = list(orientation = "h", x = 0.2, y =-0.15)), ggplotly(p2)%>%hide_legend(), ggplotly(pp)%>%hide_legend(), titleX=T,titleY=T,margin=0.035,widths=c(0.375,0.425,0.2),which_layout=1) %>% partial_bundle()
```
### maf = 0.20
```{r}
pca=PCA_list$Prune_unfiltered$maf0.2[[1]]
data_pca=data.frame(INDIV=pca$sample.id,
PC1=pca$eigenvect[,1],
PC2=pca$eigenvect[,2],
PC3=pca$eigenvect[,3],
PC4=pca$eigenvect[,4],
LOCA=c(rep("Algarve",5),
rep("Bay of Biscay",5),
rep("Gulf of Lion",5),
rep("Costa Calida",5)))
color_med_atl=rev(brewer.pal(n=4,name="RdBu"))
p<-ggplot(data=data_pca,aes(x=PC1,y=PC2,label=INDIV))+
theme_minimal()+
theme(panel.grid=element_blank(),
panel.border=element_rect(fill="transparent"),
plot.title=element_text(hjust=0.5))+
geom_hline(yintercept=0,lty=2)+
geom_vline(xintercept=0,lty=2)+
geom_point(size=3,aes(col=LOCA))+
xlab(paste("PCA 1 (",round(pca$varprop[1]*100,2),"% )",sep=""))+
ylab(paste("PCA 2 (",round(pca$varprop[2]*100,2),"% )",sep=""))+
scale_colour_manual(name="Location",
values=c(color_med_atl[2],
color_med_atl[1],
color_med_atl[3],
color_med_atl[4]))
p1<-p
p<-ggplot(data=data_pca,aes(x=PC3,y=PC4,label=INDIV))+
theme_minimal()+
theme(panel.grid=element_blank(),
panel.border=element_rect(fill="transparent"),
plot.title=element_text(hjust=0.5))+
geom_hline(yintercept=0,lty=2)+
geom_vline(xintercept=0,lty=2)+
geom_point(size=3,aes(col=LOCA))+
xlab(paste("PCA 3 (",round(pca$varprop[3]*100,2),"% )",sep=""))+
ylab(paste("PCA 4 (",round(pca$varprop[4]*100,2),"% )",sep=""))+
scale_colour_manual(name="Location",
values=c(color_med_atl[2],
color_med_atl[1],
color_med_atl[3],
color_med_atl[4]))
p2<-p
data_varpop=data.frame(PC=factor(paste("P",seq(1,10),sep=""),levels=paste("P",seq(1,10),sep="")),VAR=pca$varprop[1:10])
pp<-ggplot(data_varpop,aes(x=PC,y=VAR))+
geom_bar(stat='identity',fill="dodgerblue2",alpha=0.25)+
theme_classic()+
xlab("Principal Component")+
ylab("Variation explained (%)")
```
```{r}
subplot(ggplotly(p1)%>% layout(legend = list(orientation = "h", x = 0.2, y =-0.15)), ggplotly(p2)%>%hide_legend(), ggplotly(pp)%>%hide_legend(), titleX=T,titleY=T,margin=0.035,widths=c(0.375,0.425,0.2),which_layout=1) %>% partial_bundle()
```
### maf = 0.25
```{r}
pca=PCA_list$Prune_unfiltered$maf0.25[[1]]
data_pca=data.frame(INDIV=pca$sample.id,
PC1=pca$eigenvect[,1],
PC2=pca$eigenvect[,2],
PC3=pca$eigenvect[,3],
PC4=pca$eigenvect[,4],
LOCA=c(rep("Algarve",5),
rep("Bay of Biscay",5),
rep("Gulf of Lion",5),
rep("Costa Calida",5)))
color_med_atl=rev(brewer.pal(n=4,name="RdBu"))
p<-ggplot(data=data_pca,aes(x=PC1,y=PC2,label=INDIV))+
theme_minimal()+
theme(panel.grid=element_blank(),
panel.border=element_rect(fill="transparent"),
plot.title=element_text(hjust=0.5))+
geom_hline(yintercept=0,lty=2)+
geom_vline(xintercept=0,lty=2)+
geom_point(size=3,aes(col=LOCA))+
xlab(paste("PCA 1 (",round(pca$varprop[1]*100,2),"% )",sep=""))+
ylab(paste("PCA 2 (",round(pca$varprop[2]*100,2),"% )",sep=""))+
scale_colour_manual(name="Location",
values=c(color_med_atl[2],
color_med_atl[1],
color_med_atl[3],
color_med_atl[4]))
p1<-p
p<-ggplot(data=data_pca,aes(x=PC3,y=PC4,label=INDIV))+
theme_minimal()+
theme(panel.grid=element_blank(),
panel.border=element_rect(fill="transparent"),
plot.title=element_text(hjust=0.5))+
geom_hline(yintercept=0,lty=2)+
geom_vline(xintercept=0,lty=2)+
geom_point(size=3,aes(col=LOCA))+
xlab(paste("PCA 3 (",round(pca$varprop[3]*100,2),"% )",sep=""))+
ylab(paste("PCA 4 (",round(pca$varprop[4]*100,2),"% )",sep=""))+
scale_colour_manual(name="Location",
values=c(color_med_atl[2],
color_med_atl[1],
color_med_atl[3],
color_med_atl[4]))
p2<-p
data_varpop=data.frame(PC=factor(paste("P",seq(1,10),sep=""),levels=paste("P",seq(1,10),sep="")),VAR=pca$varprop[1:10])
pp<-ggplot(data_varpop,aes(x=PC,y=VAR))+
geom_bar(stat='identity',fill="dodgerblue2",alpha=0.25)+
theme_classic()+
xlab("Principal Component")+
ylab("Variation explained (%)")
```
```{r}
subplot(ggplotly(p1)%>% layout(legend = list(orientation = "h", x = 0.2, y =-0.15)), ggplotly(p2)%>%hide_legend(), ggplotly(pp)%>%hide_legend(), titleX=T,titleY=T,margin=0.035,widths=c(0.375,0.425,0.2),which_layout=1) %>% partial_bundle()
```
### maf = 0.30
```{r}
pca=PCA_list$Prune_unfiltered$maf0.3[[1]]
data_pca=data.frame(INDIV=pca$sample.id,
PC1=pca$eigenvect[,1],
PC2=pca$eigenvect[,2],
PC3=pca$eigenvect[,3],
PC4=pca$eigenvect[,4],
LOCA=c(rep("Algarve",5),
rep("Bay of Biscay",5),
rep("Gulf of Lion",5),
rep("Costa Calida",5)))
color_med_atl=rev(brewer.pal(n=4,name="RdBu"))
p<-ggplot(data=data_pca,aes(x=PC1,y=PC2,label=INDIV))+
theme_minimal()+
theme(panel.grid=element_blank(),
panel.border=element_rect(fill="transparent"),
plot.title=element_text(hjust=0.5))+
geom_hline(yintercept=0,lty=2)+
geom_vline(xintercept=0,lty=2)+
geom_point(size=3,aes(col=LOCA))+
xlab(paste("PCA 1 (",round(pca$varprop[1]*100,2),"% )",sep=""))+
ylab(paste("PCA 2 (",round(pca$varprop[2]*100,2),"% )",sep=""))+
scale_colour_manual(name="Location",
values=c(color_med_atl[2],
color_med_atl[1],
color_med_atl[3],
color_med_atl[4]))
p1<-p
p<-ggplot(data=data_pca,aes(x=PC3,y=PC4,label=INDIV))+
theme_minimal()+
theme(panel.grid=element_blank(),
panel.border=element_rect(fill="transparent"),
plot.title=element_text(hjust=0.5))+
geom_hline(yintercept=0,lty=2)+
geom_vline(xintercept=0,lty=2)+
geom_point(size=3,aes(col=LOCA))+
xlab(paste("PCA 3 (",round(pca$varprop[3]*100,2),"% )",sep=""))+
ylab(paste("PCA 4 (",round(pca$varprop[4]*100,2),"% )",sep=""))+
scale_colour_manual(name="Location",
values=c(color_med_atl[2],
color_med_atl[1],
color_med_atl[3],
color_med_atl[4]))
p2<-p
data_varpop=data.frame(PC=factor(paste("P",seq(1,10),sep=""),levels=paste("P",seq(1,10),sep="")),VAR=pca$varprop[1:10])
pp<-ggplot(data_varpop,aes(x=PC,y=VAR))+
geom_bar(stat='identity',fill="dodgerblue2",alpha=0.25)+
theme_classic()+
xlab("Principal Component")+
ylab("Variation explained (%)")
```
```{r}
subplot(ggplotly(p1)%>% layout(legend = list(orientation = "h", x = 0.2, y =-0.15)), ggplotly(p2)%>%hide_legend(), ggplotly(pp)%>%hide_legend(), titleX=T,titleY=T,margin=0.035,widths=c(0.375,0.425,0.2),which_layout=1) %>% partial_bundle()
```
### maf = 0.35
```{r}
pca=PCA_list$Prune_unfiltered$maf0.35[[1]]
data_pca=data.frame(INDIV=pca$sample.id,
PC1=pca$eigenvect[,1],
PC2=pca$eigenvect[,2],
PC3=pca$eigenvect[,3],
PC4=pca$eigenvect[,4],
LOCA=c(rep("Algarve",5),
rep("Bay of Biscay",5),
rep("Gulf of Lion",5),
rep("Costa Calida",5)))
color_med_atl=rev(brewer.pal(n=4,name="RdBu"))
p<-ggplot(data=data_pca,aes(x=PC1,y=PC2,label=INDIV))+
theme_minimal()+
theme(panel.grid=element_blank(),
panel.border=element_rect(fill="transparent"),
plot.title=element_text(hjust=0.5))+
geom_hline(yintercept=0,lty=2)+
geom_vline(xintercept=0,lty=2)+
geom_point(size=3,aes(col=LOCA))+
xlab(paste("PCA 1 (",round(pca$varprop[1]*100,2),"% )",sep=""))+
ylab(paste("PCA 2 (",round(pca$varprop[2]*100,2),"% )",sep=""))+
scale_colour_manual(name="Location",
values=c(color_med_atl[2],
color_med_atl[1],
color_med_atl[3],
color_med_atl[4]))
p1<-p
p<-ggplot(data=data_pca,aes(x=PC3,y=PC4,label=INDIV))+
theme_minimal()+
theme(panel.grid=element_blank(),
panel.border=element_rect(fill="transparent"),
plot.title=element_text(hjust=0.5))+
geom_hline(yintercept=0,lty=2)+
geom_vline(xintercept=0,lty=2)+
geom_point(size=3,aes(col=LOCA))+
xlab(paste("PCA 3 (",round(pca$varprop[3]*100,2),"% )",sep=""))+
ylab(paste("PCA 4 (",round(pca$varprop[4]*100,2),"% )",sep=""))+
scale_colour_manual(name="Location",
values=c(color_med_atl[2],
color_med_atl[1],
color_med_atl[3],
color_med_atl[4]))
p2<-p
data_varpop=data.frame(PC=factor(paste("P",seq(1,10),sep=""),levels=paste("P",seq(1,10),sep="")),VAR=pca$varprop[1:10])
pp<-ggplot(data_varpop,aes(x=PC,y=VAR))+
geom_bar(stat='identity',fill="dodgerblue2",alpha=0.25)+
theme_classic()+
xlab("Principal Component")+
ylab("Variation explained (%)")
```
```{r}
subplot(ggplotly(p1)%>% layout(legend = list(orientation = "h", x = 0.2, y =-0.15)), ggplotly(p2)%>%hide_legend(), ggplotly(pp)%>%hide_legend(), titleX=T,titleY=T,margin=0.035,widths=c(0.375,0.425,0.2),which_layout=1) %>% partial_bundle()
```
### maf = 0.40
```{r}
pca=PCA_list$Prune_unfiltered$maf0.4[[1]]
data_pca=data.frame(INDIV=pca$sample.id,
PC1=pca$eigenvect[,1],
PC2=pca$eigenvect[,2],
PC3=pca$eigenvect[,3],
PC4=pca$eigenvect[,4],
LOCA=c(rep("Algarve",5),
rep("Bay of Biscay",5),
rep("Gulf of Lion",5),
rep("Costa Calida",5)))
color_med_atl=rev(brewer.pal(n=4,name="RdBu"))
p<-ggplot(data=data_pca,aes(x=PC1,y=PC2,label=INDIV))+
theme_minimal()+
theme(panel.grid=element_blank(),
panel.border=element_rect(fill="transparent"),
plot.title=element_text(hjust=0.5))+
geom_hline(yintercept=0,lty=2)+
geom_vline(xintercept=0,lty=2)+
geom_point(size=3,aes(col=LOCA))+
xlab(paste("PCA 1 (",round(pca$varprop[1]*100,2),"% )",sep=""))+
ylab(paste("PCA 2 (",round(pca$varprop[2]*100,2),"% )",sep=""))+
scale_colour_manual(name="Location",
values=c(color_med_atl[2],
color_med_atl[1],
color_med_atl[3],
color_med_atl[4]))
p1<-p
p<-ggplot(data=data_pca,aes(x=PC3,y=PC4,label=INDIV))+
theme_minimal()+
theme(panel.grid=element_blank(),
panel.border=element_rect(fill="transparent"),
plot.title=element_text(hjust=0.5))+
geom_hline(yintercept=0,lty=2)+
geom_vline(xintercept=0,lty=2)+
geom_point(size=3,aes(col=LOCA))+
xlab(paste("PCA 3 (",round(pca$varprop[3]*100,2),"% )",sep=""))+
ylab(paste("PCA 4 (",round(pca$varprop[4]*100,2),"% )",sep=""))+
scale_colour_manual(name="Location",
values=c(color_med_atl[2],
color_med_atl[1],
color_med_atl[3],
color_med_atl[4]))
p2<-p
data_varpop=data.frame(PC=factor(paste("P",seq(1,10),sep=""),levels=paste("P",seq(1,10),sep="")),VAR=pca$varprop[1:10])
pp<-ggplot(data_varpop,aes(x=PC,y=VAR))+
geom_bar(stat='identity',fill="dodgerblue2",alpha=0.25)+
theme_classic()+
xlab("Principal Component")+
ylab("Variation explained (%)")
```
```{r}
subplot(ggplotly(p1)%>% layout(legend = list(orientation = "h", x = 0.2, y =-0.15)), ggplotly(p2)%>%hide_legend(), ggplotly(pp)%>%hide_legend(), titleX=T,titleY=T,margin=0.035,widths=c(0.375,0.425,0.2),which_layout=1) %>% partial_bundle()
```
### maf = 0.45
```{r}
pca=PCA_list$Prune_unfiltered$maf0.45[[1]]
data_pca=data.frame(INDIV=pca$sample.id,
PC1=pca$eigenvect[,1],
PC2=pca$eigenvect[,2],
PC3=pca$eigenvect[,3],
PC4=pca$eigenvect[,4],
LOCA=c(rep("Algarve",5),
rep("Bay of Biscay",5),
rep("Gulf of Lion",5),
rep("Costa Calida",5)))
color_med_atl=rev(brewer.pal(n=4,name="RdBu"))
p<-ggplot(data=data_pca,aes(x=PC1,y=PC2,label=INDIV))+
theme_minimal()+
theme(panel.grid=element_blank(),
panel.border=element_rect(fill="transparent"),
plot.title=element_text(hjust=0.5))+
geom_hline(yintercept=0,lty=2)+
geom_vline(xintercept=0,lty=2)+
geom_point(size=3,aes(col=LOCA))+
xlab(paste("PCA 1 (",round(pca$varprop[1]*100,2),"% )",sep=""))+
ylab(paste("PCA 2 (",round(pca$varprop[2]*100,2),"% )",sep=""))+
scale_colour_manual(name="Location",
values=c(color_med_atl[2],
color_med_atl[1],
color_med_atl[3],
color_med_atl[4]))
p1<-p
p<-ggplot(data=data_pca,aes(x=PC3,y=PC4,label=INDIV))+
theme_minimal()+
theme(panel.grid=element_blank(),
panel.border=element_rect(fill="transparent"),
plot.title=element_text(hjust=0.5))+
geom_hline(yintercept=0,lty=2)+
geom_vline(xintercept=0,lty=2)+
geom_point(size=3,aes(col=LOCA))+
xlab(paste("PCA 3 (",round(pca$varprop[3]*100,2),"% )",sep=""))+
ylab(paste("PCA 4 (",round(pca$varprop[4]*100,2),"% )",sep=""))+
scale_colour_manual(name="Location",
values=c(color_med_atl[2],
color_med_atl[1],
color_med_atl[3],
color_med_atl[4]))
p2<-p
data_varpop=data.frame(PC=factor(paste("P",seq(1,10),sep=""),levels=paste("P",seq(1,10),sep="")),VAR=pca$varprop[1:10])
pp<-ggplot(data_varpop,aes(x=PC,y=VAR))+
geom_bar(stat='identity',fill="dodgerblue2",alpha=0.25)+
theme_classic()+
xlab("Principal Component")+
ylab("Variation explained (%)")
```
```{r}
subplot(ggplotly(p1)%>% layout(legend = list(orientation = "h", x = 0.2, y =-0.15)), ggplotly(p2)%>%hide_legend(), ggplotly(pp)%>%hide_legend(), titleX=T,titleY=T,margin=0.035,widths=c(0.375,0.425,0.2),which_layout=1) %>% partial_bundle()
```
### maf = 0.50
```{r}
pca=PCA_list$Prune_unfiltered$maf0.5[[1]]
data_pca=data.frame(INDIV=pca$sample.id,
PC1=pca$eigenvect[,1],
PC2=pca$eigenvect[,2],
PC3=pca$eigenvect[,3],
PC4=pca$eigenvect[,4],
LOCA=c(rep("Algarve",5),
rep("Bay of Biscay",5),
rep("Gulf of Lion",5),
rep("Costa Calida",5)))
color_med_atl=rev(brewer.pal(n=4,name="RdBu"))
p<-ggplot(data=data_pca,aes(x=PC1,y=PC2,label=INDIV))+
theme_minimal()+
theme(panel.grid=element_blank(),
panel.border=element_rect(fill="transparent"),
plot.title=element_text(hjust=0.5))+
geom_hline(yintercept=0,lty=2)+
geom_vline(xintercept=0,lty=2)+
geom_point(size=3,aes(col=LOCA))+
xlab(paste("PCA 1 (",round(pca$varprop[1]*100,2),"% )",sep=""))+
ylab(paste("PCA 2 (",round(pca$varprop[2]*100,2),"% )",sep=""))+
scale_colour_manual(name="Location",
values=c(color_med_atl[2],
color_med_atl[1],
color_med_atl[3],
color_med_atl[4]))
p1<-p
p<-ggplot(data=data_pca,aes(x=PC3,y=PC4,label=INDIV))+
theme_minimal()+
theme(panel.grid=element_blank(),
panel.border=element_rect(fill="transparent"),
plot.title=element_text(hjust=0.5))+
geom_hline(yintercept=0,lty=2)+
geom_vline(xintercept=0,lty=2)+
geom_point(size=3,aes(col=LOCA))+
xlab(paste("PCA 3 (",round(pca$varprop[3]*100,2),"% )",sep=""))+
ylab(paste("PCA 4 (",round(pca$varprop[4]*100,2),"% )",sep=""))+
scale_colour_manual(name="Location",
values=c(color_med_atl[2],
color_med_atl[1],
color_med_atl[3],
color_med_atl[4]))
p2<-p
data_varpop=data.frame(PC=factor(paste("P",seq(1,10),sep=""),levels=paste("P",seq(1,10),sep="")),VAR=pca$varprop[1:10])
pp<-ggplot(data_varpop,aes(x=PC,y=VAR))+
geom_bar(stat='identity',fill="dodgerblue2",alpha=0.25)+
theme_classic()+
xlab("Principal Component")+
ylab("Variation explained (%)")
```
```{r}
subplot(ggplotly(p1)%>% layout(legend = list(orientation = "h", x = 0.2, y =-0.15)), ggplotly(p2)%>%hide_legend(), ggplotly(pp)%>%hide_legend(), titleX=T,titleY=T,margin=0.035,widths=c(0.375,0.425,0.2),which_layout=1) %>% partial_bundle()
```
Serranus cabrilla {data-navmenu="Species"}
=======================================================================
```{r, include = FALSE}
load(file = paste(path,"/output/pca/Scabr_PCA_list.Rdata",sep=""))
```
Row {.tabset data-height=100}
-----------------------
<center>
<font size="6">**Serranus cabrilla**</font>
</center>
Row {.tabset data-height=50}
-----------------------
<center>
<font size="6">**All filtered SNPS**</font>
</center>
Row {.tabset data-height=600}
-----------------------
### maf = 0
```{r}
pca=PCA_list$All_filtered$maf0[[1]]
data_pca=data.frame(INDIV=pca$sample.id,
PC1=pca$eigenvect[,1],
PC2=pca$eigenvect[,2],
PC3=pca$eigenvect[,3],
PC4=pca$eigenvect[,4],
LOCA=c(rep("Algarve",5),
rep("Bay of Biscay",5),
rep("Gulf of Lion",5),
rep("Costa Calida",5)))
color_med_atl=rev(brewer.pal(n=4,name="RdBu"))
p<-ggplot(data=data_pca,aes(x=PC1,y=PC2,label=INDIV))+
theme_minimal()+
theme(panel.grid=element_blank(),
panel.border=element_rect(fill="transparent"),
plot.title=element_text(hjust=0.5))+
geom_hline(yintercept=0,lty=2)+
geom_vline(xintercept=0,lty=2)+
geom_point(size=3,aes(col=LOCA))+
xlab(paste("PCA 1 (",round(pca$varprop[1]*100,2),"% )",sep=""))+
ylab(paste("PCA 2 (",round(pca$varprop[2]*100,2),"% )",sep=""))+
scale_colour_manual(name="Location",
values=c(color_med_atl[2],
color_med_atl[1],
color_med_atl[3],
color_med_atl[4]))
p1<-p
p<-ggplot(data=data_pca,aes(x=PC3,y=PC4,label=INDIV))+
theme_minimal()+
theme(panel.grid=element_blank(),
panel.border=element_rect(fill="transparent"),
plot.title=element_text(hjust=0.5))+
geom_hline(yintercept=0,lty=2)+
geom_vline(xintercept=0,lty=2)+
geom_point(size=3,aes(col=LOCA))+
xlab(paste("PCA 3 (",round(pca$varprop[3]*100,2),"% )",sep=""))+
ylab(paste("PCA 4 (",round(pca$varprop[4]*100,2),"% )",sep=""))+
scale_colour_manual(name="Location",
values=c(color_med_atl[2],
color_med_atl[1],
color_med_atl[3],
color_med_atl[4]))
p2<-p
data_varpop=data.frame(PC=factor(paste("P",seq(1,10),sep=""),levels=paste("P",seq(1,10),sep="")),VAR=pca$varprop[1:10])
pp<-ggplot(data_varpop,aes(x=PC,y=VAR))+
geom_bar(stat='identity',fill="dodgerblue2",alpha=0.25)+
theme_classic()+
xlab("Principal Component")+
ylab("Variation explained (%)")
```
```{r}
subplot(ggplotly(p1)%>% layout(legend = list(orientation = "h", x = 0.2, y =-0.15)), ggplotly(p2)%>%hide_legend(), ggplotly(pp)%>%hide_legend(), titleX=T,titleY=T,margin=0.035,widths=c(0.375,0.425,0.2),which_layout=1) %>% partial_bundle()
```
### maf = 0.05
```{r}
pca=PCA_list$All_filtered$maf0.05[[1]]
data_pca=data.frame(INDIV=pca$sample.id,
PC1=pca$eigenvect[,1],
PC2=pca$eigenvect[,2],
PC3=pca$eigenvect[,3],
PC4=pca$eigenvect[,4],
LOCA=c(rep("Algarve",5),
rep("Bay of Biscay",5),
rep("Gulf of Lion",5),
rep("Costa Calida",5)))
color_med_atl=rev(brewer.pal(n=4,name="RdBu"))
p<-ggplot(data=data_pca,aes(x=PC1,y=PC2,label=INDIV))+
theme_minimal()+
theme(panel.grid=element_blank(),
panel.border=element_rect(fill="transparent"),
plot.title=element_text(hjust=0.5))+
geom_hline(yintercept=0,lty=2)+
geom_vline(xintercept=0,lty=2)+
geom_point(size=3,aes(col=LOCA))+
xlab(paste("PCA 1 (",round(pca$varprop[1]*100,2),"% )",sep=""))+
ylab(paste("PCA 2 (",round(pca$varprop[2]*100,2),"% )",sep=""))+
scale_colour_manual(name="Location",
values=c(color_med_atl[2],
color_med_atl[1],
color_med_atl[3],
color_med_atl[4]))
p1<-p
p<-ggplot(data=data_pca,aes(x=PC3,y=PC4,label=INDIV))+
theme_minimal()+
theme(panel.grid=element_blank(),
panel.border=element_rect(fill="transparent"),
plot.title=element_text(hjust=0.5))+
geom_hline(yintercept=0,lty=2)+
geom_vline(xintercept=0,lty=2)+
geom_point(size=3,aes(col=LOCA))+
xlab(paste("PCA 3 (",round(pca$varprop[3]*100,2),"% )",sep=""))+
ylab(paste("PCA 4 (",round(pca$varprop[4]*100,2),"% )",sep=""))+
scale_colour_manual(name="Location",
values=c(color_med_atl[2],
color_med_atl[1],
color_med_atl[3],
color_med_atl[4]))
p2<-p
data_varpop=data.frame(PC=factor(paste("P",seq(1,10),sep=""),levels=paste("P",seq(1,10),sep="")),VAR=pca$varprop[1:10])
pp<-ggplot(data_varpop,aes(x=PC,y=VAR))+
geom_bar(stat='identity',fill="dodgerblue2",alpha=0.25)+
theme_classic()+
xlab("Principal Component")+
ylab("Variation explained (%)")
```
```{r}
subplot(ggplotly(p1)%>% layout(legend = list(orientation = "h", x = 0.2, y =-0.15)), ggplotly(p2)%>%hide_legend(), ggplotly(pp)%>%hide_legend(), titleX=T,titleY=T,margin=0.035,widths=c(0.375,0.425,0.2),which_layout=1) %>% partial_bundle()
```
### maf = 0.1
```{r}
pca=PCA_list$All_filtered$maf0.1[[1]]
data_pca=data.frame(INDIV=pca$sample.id,
PC1=pca$eigenvect[,1],
PC2=pca$eigenvect[,2],
PC3=pca$eigenvect[,3],
PC4=pca$eigenvect[,4],
LOCA=c(rep("Algarve",5),
rep("Bay of Biscay",5),
rep("Gulf of Lion",5),
rep("Costa Calida",5)))
color_med_atl=rev(brewer.pal(n=4,name="RdBu"))
p<-ggplot(data=data_pca,aes(x=PC1,y=PC2,label=INDIV))+
theme_minimal()+
theme(panel.grid=element_blank(),
panel.border=element_rect(fill="transparent"),
plot.title=element_text(hjust=0.5))+
geom_hline(yintercept=0,lty=2)+
geom_vline(xintercept=0,lty=2)+
geom_point(size=3,aes(col=LOCA))+
xlab(paste("PCA 1 (",round(pca$varprop[1]*100,2),"% )",sep=""))+
ylab(paste("PCA 2 (",round(pca$varprop[2]*100,2),"% )",sep=""))+
scale_colour_manual(name="Location",
values=c(color_med_atl[2],
color_med_atl[1],
color_med_atl[3],
color_med_atl[4]))
p1<-p
p<-ggplot(data=data_pca,aes(x=PC3,y=PC4,label=INDIV))+
theme_minimal()+
theme(panel.grid=element_blank(),
panel.border=element_rect(fill="transparent"),
plot.title=element_text(hjust=0.5))+
geom_hline(yintercept=0,lty=2)+
geom_vline(xintercept=0,lty=2)+
geom_point(size=3,aes(col=LOCA))+
xlab(paste("PCA 3 (",round(pca$varprop[3]*100,2),"% )",sep=""))+
ylab(paste("PCA 4 (",round(pca$varprop[4]*100,2),"% )",sep=""))+
scale_colour_manual(name="Location",
values=c(color_med_atl[2],
color_med_atl[1],
color_med_atl[3],
color_med_atl[4]))
p2<-p
data_varpop=data.frame(PC=factor(paste("P",seq(1,10),sep=""),levels=paste("P",seq(1,10),sep="")),VAR=pca$varprop[1:10])
pp<-ggplot(data_varpop,aes(x=PC,y=VAR))+
geom_bar(stat='identity',fill="dodgerblue2",alpha=0.25)+
theme_classic()+
xlab("Principal Component")+
ylab("Variation explained (%)")
```
```{r}
subplot(ggplotly(p1)%>% layout(legend = list(orientation = "h", x = 0.2, y =-0.15)), ggplotly(p2)%>%hide_legend(), ggplotly(pp)%>%hide_legend(), titleX=T,titleY=T,margin=0.035,widths=c(0.375,0.425,0.2),which_layout=1) %>% partial_bundle()
```
### maf = 0.15
```{r}
pca=PCA_list$All_filtered$maf0.15[[1]]
data_pca=data.frame(INDIV=pca$sample.id,
PC1=pca$eigenvect[,1],
PC2=pca$eigenvect[,2],
PC3=pca$eigenvect[,3],
PC4=pca$eigenvect[,4],
LOCA=c(rep("Algarve",5),
rep("Bay of Biscay",5),
rep("Gulf of Lion",5),
rep("Costa Calida",5)))
color_med_atl=rev(brewer.pal(n=4,name="RdBu"))
p<-ggplot(data=data_pca,aes(x=PC1,y=PC2,label=INDIV))+
theme_minimal()+
theme(panel.grid=element_blank(),
panel.border=element_rect(fill="transparent"),
plot.title=element_text(hjust=0.5))+
geom_hline(yintercept=0,lty=2)+
geom_vline(xintercept=0,lty=2)+
geom_point(size=3,aes(col=LOCA))+
xlab(paste("PCA 1 (",round(pca$varprop[1]*100,2),"% )",sep=""))+
ylab(paste("PCA 2 (",round(pca$varprop[2]*100,2),"% )",sep=""))+
scale_colour_manual(name="Location",
values=c(color_med_atl[2],
color_med_atl[1],
color_med_atl[3],
color_med_atl[4]))
p1<-p
p<-ggplot(data=data_pca,aes(x=PC3,y=PC4,label=INDIV))+
theme_minimal()+
theme(panel.grid=element_blank(),
panel.border=element_rect(fill="transparent"),
plot.title=element_text(hjust=0.5))+
geom_hline(yintercept=0,lty=2)+
geom_vline(xintercept=0,lty=2)+
geom_point(size=3,aes(col=LOCA))+
xlab(paste("PCA 3 (",round(pca$varprop[3]*100,2),"% )",sep=""))+
ylab(paste("PCA 4 (",round(pca$varprop[4]*100,2),"% )",sep=""))+
scale_colour_manual(name="Location",
values=c(color_med_atl[2],
color_med_atl[1],
color_med_atl[3],
color_med_atl[4]))
p2<-p
data_varpop=data.frame(PC=factor(paste("P",seq(1,10),sep=""),levels=paste("P",seq(1,10),sep="")),VAR=pca$varprop[1:10])
pp<-ggplot(data_varpop,aes(x=PC,y=VAR))+
geom_bar(stat='identity',fill="dodgerblue2",alpha=0.25)+
theme_classic()+
xlab("Principal Component")+
ylab("Variation explained (%)")
```
```{r}
subplot(ggplotly(p1)%>% layout(legend = list(orientation = "h", x = 0.2, y =-0.15)), ggplotly(p2)%>%hide_legend(), ggplotly(pp)%>%hide_legend(), titleX=T,titleY=T,margin=0.035,widths=c(0.375,0.425,0.2),which_layout=1) %>% partial_bundle()
```
### maf = 0.20
```{r}
pca=PCA_list$All_filtered$maf0.2[[1]]
data_pca=data.frame(INDIV=pca$sample.id,
PC1=pca$eigenvect[,1],
PC2=pca$eigenvect[,2],
PC3=pca$eigenvect[,3],
PC4=pca$eigenvect[,4],
LOCA=c(rep("Algarve",5),
rep("Bay of Biscay",5),
rep("Gulf of Lion",5),
rep("Costa Calida",5)))
color_med_atl=rev(brewer.pal(n=4,name="RdBu"))
p<-ggplot(data=data_pca,aes(x=PC1,y=PC2,label=INDIV))+
theme_minimal()+
theme(panel.grid=element_blank(),
panel.border=element_rect(fill="transparent"),
plot.title=element_text(hjust=0.5))+
geom_hline(yintercept=0,lty=2)+
geom_vline(xintercept=0,lty=2)+
geom_point(size=3,aes(col=LOCA))+
xlab(paste("PCA 1 (",round(pca$varprop[1]*100,2),"% )",sep=""))+
ylab(paste("PCA 2 (",round(pca$varprop[2]*100,2),"% )",sep=""))+
scale_colour_manual(name="Location",
values=c(color_med_atl[2],
color_med_atl[1],
color_med_atl[3],
color_med_atl[4]))
p1<-p
p<-ggplot(data=data_pca,aes(x=PC3,y=PC4,label=INDIV))+
theme_minimal()+
theme(panel.grid=element_blank(),
panel.border=element_rect(fill="transparent"),
plot.title=element_text(hjust=0.5))+
geom_hline(yintercept=0,lty=2)+
geom_vline(xintercept=0,lty=2)+
geom_point(size=3,aes(col=LOCA))+
xlab(paste("PCA 3 (",round(pca$varprop[3]*100,2),"% )",sep=""))+
ylab(paste("PCA 4 (",round(pca$varprop[4]*100,2),"% )",sep=""))+
scale_colour_manual(name="Location",
values=c(color_med_atl[2],
color_med_atl[1],
color_med_atl[3],
color_med_atl[4]))
p2<-p
data_varpop=data.frame(PC=factor(paste("P",seq(1,10),sep=""),levels=paste("P",seq(1,10),sep="")),VAR=pca$varprop[1:10])
pp<-ggplot(data_varpop,aes(x=PC,y=VAR))+
geom_bar(stat='identity',fill="dodgerblue2",alpha=0.25)+
theme_classic()+
xlab("Principal Component")+
ylab("Variation explained (%)")
```
```{r}
subplot(ggplotly(p1)%>% layout(legend = list(orientation = "h", x = 0.2, y =-0.15)), ggplotly(p2)%>%hide_legend(), ggplotly(pp)%>%hide_legend(), titleX=T,titleY=T,margin=0.035,widths=c(0.375,0.425,0.2),which_layout=1) %>% partial_bundle()
```
### maf = 0.25
```{r}
pca=PCA_list$All_filtered$maf0.25[[1]]
data_pca=data.frame(INDIV=pca$sample.id,
PC1=pca$eigenvect[,1],
PC2=pca$eigenvect[,2],
PC3=pca$eigenvect[,3],
PC4=pca$eigenvect[,4],
LOCA=c(rep("Algarve",5),
rep("Bay of Biscay",5),
rep("Gulf of Lion",5),
rep("Costa Calida",5)))
color_med_atl=rev(brewer.pal(n=4,name="RdBu"))
p<-ggplot(data=data_pca,aes(x=PC1,y=PC2,label=INDIV))+
theme_minimal()+
theme(panel.grid=element_blank(),
panel.border=element_rect(fill="transparent"),
plot.title=element_text(hjust=0.5))+
geom_hline(yintercept=0,lty=2)+
geom_vline(xintercept=0,lty=2)+
geom_point(size=3,aes(col=LOCA))+
xlab(paste("PCA 1 (",round(pca$varprop[1]*100,2),"% )",sep=""))+
ylab(paste("PCA 2 (",round(pca$varprop[2]*100,2),"% )",sep=""))+
scale_colour_manual(name="Location",
values=c(color_med_atl[2],
color_med_atl[1],
color_med_atl[3],
color_med_atl[4]))
p1<-p
p<-ggplot(data=data_pca,aes(x=PC3,y=PC4,label=INDIV))+
theme_minimal()+
theme(panel.grid=element_blank(),
panel.border=element_rect(fill="transparent"),
plot.title=element_text(hjust=0.5))+
geom_hline(yintercept=0,lty=2)+
geom_vline(xintercept=0,lty=2)+
geom_point(size=3,aes(col=LOCA))+
xlab(paste("PCA 3 (",round(pca$varprop[3]*100,2),"% )",sep=""))+
ylab(paste("PCA 4 (",round(pca$varprop[4]*100,2),"% )",sep=""))+
scale_colour_manual(name="Location",
values=c(color_med_atl[2],
color_med_atl[1],
color_med_atl[3],
color_med_atl[4]))
p2<-p
data_varpop=data.frame(PC=factor(paste("P",seq(1,10),sep=""),levels=paste("P",seq(1,10),sep="")),VAR=pca$varprop[1:10])
pp<-ggplot(data_varpop,aes(x=PC,y=VAR))+
geom_bar(stat='identity',fill="dodgerblue2",alpha=0.25)+
theme_classic()+
xlab("Principal Component")+
ylab("Variation explained (%)")
```
```{r}
subplot(ggplotly(p1)%>% layout(legend = list(orientation = "h", x = 0.2, y =-0.15)), ggplotly(p2)%>%hide_legend(), ggplotly(pp)%>%hide_legend(), titleX=T,titleY=T,margin=0.035,widths=c(0.375,0.425,0.2),which_layout=1) %>% partial_bundle()
```
### maf = 0.30
```{r}
pca=PCA_list$All_filtered$maf0.3[[1]]
data_pca=data.frame(INDIV=pca$sample.id,
PC1=pca$eigenvect[,1],
PC2=pca$eigenvect[,2],
PC3=pca$eigenvect[,3],
PC4=pca$eigenvect[,4],
LOCA=c(rep("Algarve",5),
rep("Bay of Biscay",5),
rep("Gulf of Lion",5),
rep("Costa Calida",5)))
color_med_atl=rev(brewer.pal(n=4,name="RdBu"))
p<-ggplot(data=data_pca,aes(x=PC1,y=PC2,label=INDIV))+
theme_minimal()+
theme(panel.grid=element_blank(),
panel.border=element_rect(fill="transparent"),
plot.title=element_text(hjust=0.5))+
geom_hline(yintercept=0,lty=2)+
geom_vline(xintercept=0,lty=2)+
geom_point(size=3,aes(col=LOCA))+
xlab(paste("PCA 1 (",round(pca$varprop[1]*100,2),"% )",sep=""))+
ylab(paste("PCA 2 (",round(pca$varprop[2]*100,2),"% )",sep=""))+
scale_colour_manual(name="Location",
values=c(color_med_atl[2],
color_med_atl[1],
color_med_atl[3],
color_med_atl[4]))
p1<-p
p<-ggplot(data=data_pca,aes(x=PC3,y=PC4,label=INDIV))+
theme_minimal()+
theme(panel.grid=element_blank(),
panel.border=element_rect(fill="transparent"),
plot.title=element_text(hjust=0.5))+
geom_hline(yintercept=0,lty=2)+
geom_vline(xintercept=0,lty=2)+
geom_point(size=3,aes(col=LOCA))+
xlab(paste("PCA 3 (",round(pca$varprop[3]*100,2),"% )",sep=""))+
ylab(paste("PCA 4 (",round(pca$varprop[4]*100,2),"% )",sep=""))+
scale_colour_manual(name="Location",
values=c(color_med_atl[2],
color_med_atl[1],
color_med_atl[3],
color_med_atl[4]))
p2<-p
data_varpop=data.frame(PC=factor(paste("P",seq(1,10),sep=""),levels=paste("P",seq(1,10),sep="")),VAR=pca$varprop[1:10])
pp<-ggplot(data_varpop,aes(x=PC,y=VAR))+
geom_bar(stat='identity',fill="dodgerblue2",alpha=0.25)+
theme_classic()+
xlab("Principal Component")+
ylab("Variation explained (%)")
```
```{r}
subplot(ggplotly(p1)%>% layout(legend = list(orientation = "h", x = 0.2, y =-0.15)), ggplotly(p2)%>%hide_legend(), ggplotly(pp)%>%hide_legend(), titleX=T,titleY=T,margin=0.035,widths=c(0.375,0.425,0.2),which_layout=1) %>% partial_bundle()
```
### maf = 0.35
```{r}
pca=PCA_list$All_filtered$maf0.35[[1]]
data_pca=data.frame(INDIV=pca$sample.id,
PC1=pca$eigenvect[,1],
PC2=pca$eigenvect[,2],
PC3=pca$eigenvect[,3],
PC4=pca$eigenvect[,4],
LOCA=c(rep("Algarve",5),
rep("Bay of Biscay",5),
rep("Gulf of Lion",5),
rep("Costa Calida",5)))
color_med_atl=rev(brewer.pal(n=4,name="RdBu"))
p<-ggplot(data=data_pca,aes(x=PC1,y=PC2,label=INDIV))+
theme_minimal()+
theme(panel.grid=element_blank(),
panel.border=element_rect(fill="transparent"),
plot.title=element_text(hjust=0.5))+
geom_hline(yintercept=0,lty=2)+
geom_vline(xintercept=0,lty=2)+
geom_point(size=3,aes(col=LOCA))+
xlab(paste("PCA 1 (",round(pca$varprop[1]*100,2),"% )",sep=""))+
ylab(paste("PCA 2 (",round(pca$varprop[2]*100,2),"% )",sep=""))+
scale_colour_manual(name="Location",
values=c(color_med_atl[2],
color_med_atl[1],
color_med_atl[3],
color_med_atl[4]))
p1<-p
p<-ggplot(data=data_pca,aes(x=PC3,y=PC4,label=INDIV))+
theme_minimal()+
theme(panel.grid=element_blank(),
panel.border=element_rect(fill="transparent"),
plot.title=element_text(hjust=0.5))+
geom_hline(yintercept=0,lty=2)+
geom_vline(xintercept=0,lty=2)+
geom_point(size=3,aes(col=LOCA))+
xlab(paste("PCA 3 (",round(pca$varprop[3]*100,2),"% )",sep=""))+
ylab(paste("PCA 4 (",round(pca$varprop[4]*100,2),"% )",sep=""))+
scale_colour_manual(name="Location",
values=c(color_med_atl[2],
color_med_atl[1],
color_med_atl[3],
color_med_atl[4]))
p2<-p
data_varpop=data.frame(PC=factor(paste("P",seq(1,10),sep=""),levels=paste("P",seq(1,10),sep="")),VAR=pca$varprop[1:10])
pp<-ggplot(data_varpop,aes(x=PC,y=VAR))+
geom_bar(stat='identity',fill="dodgerblue2",alpha=0.25)+
theme_classic()+
xlab("Principal Component")+
ylab("Variation explained (%)")
```
```{r}
subplot(ggplotly(p1)%>% layout(legend = list(orientation = "h", x = 0.2, y =-0.15)), ggplotly(p2)%>%hide_legend(), ggplotly(pp)%>%hide_legend(), titleX=T,titleY=T,margin=0.035,widths=c(0.375,0.425,0.2),which_layout=1) %>% partial_bundle()
```
### maf = 0.40
```{r}
pca=PCA_list$All_filtered$maf0.4[[1]]
data_pca=data.frame(INDIV=pca$sample.id,
PC1=pca$eigenvect[,1],
PC2=pca$eigenvect[,2],
PC3=pca$eigenvect[,3],
PC4=pca$eigenvect[,4],
LOCA=c(rep("Algarve",5),
rep("Bay of Biscay",5),
rep("Gulf of Lion",5),
rep("Costa Calida",5)))
color_med_atl=rev(brewer.pal(n=4,name="RdBu"))
p<-ggplot(data=data_pca,aes(x=PC1,y=PC2,label=INDIV))+
theme_minimal()+
theme(panel.grid=element_blank(),
panel.border=element_rect(fill="transparent"),
plot.title=element_text(hjust=0.5))+
geom_hline(yintercept=0,lty=2)+
geom_vline(xintercept=0,lty=2)+
geom_point(size=3,aes(col=LOCA))+
xlab(paste("PCA 1 (",round(pca$varprop[1]*100,2),"% )",sep=""))+
ylab(paste("PCA 2 (",round(pca$varprop[2]*100,2),"% )",sep=""))+
scale_colour_manual(name="Location",
values=c(color_med_atl[2],
color_med_atl[1],
color_med_atl[3],
color_med_atl[4]))
p1<-p
p<-ggplot(data=data_pca,aes(x=PC3,y=PC4,label=INDIV))+
theme_minimal()+
theme(panel.grid=element_blank(),
panel.border=element_rect(fill="transparent"),
plot.title=element_text(hjust=0.5))+
geom_hline(yintercept=0,lty=2)+
geom_vline(xintercept=0,lty=2)+
geom_point(size=3,aes(col=LOCA))+
xlab(paste("PCA 3 (",round(pca$varprop[3]*100,2),"% )",sep=""))+
ylab(paste("PCA 4 (",round(pca$varprop[4]*100,2),"% )",sep=""))+
scale_colour_manual(name="Location",
values=c(color_med_atl[2],
color_med_atl[1],
color_med_atl[3],
color_med_atl[4]))
p2<-p
data_varpop=data.frame(PC=factor(paste("P",seq(1,10),sep=""),levels=paste("P",seq(1,10),sep="")),VAR=pca$varprop[1:10])
pp<-ggplot(data_varpop,aes(x=PC,y=VAR))+
geom_bar(stat='identity',fill="dodgerblue2",alpha=0.25)+
theme_classic()+
xlab("Principal Component")+
ylab("Variation explained (%)")
```
```{r}
subplot(ggplotly(p1)%>% layout(legend = list(orientation = "h", x = 0.2, y =-0.15)), ggplotly(p2)%>%hide_legend(), ggplotly(pp)%>%hide_legend(), titleX=T,titleY=T,margin=0.035,widths=c(0.375,0.425,0.2),which_layout=1) %>% partial_bundle()
```
### maf = 0.45
```{r}
pca=PCA_list$All_filtered$maf0.45[[1]]
data_pca=data.frame(INDIV=pca$sample.id,
PC1=pca$eigenvect[,1],
PC2=pca$eigenvect[,2],
PC3=pca$eigenvect[,3],
PC4=pca$eigenvect[,4],
LOCA=c(rep("Algarve",5),
rep("Bay of Biscay",5),
rep("Gulf of Lion",5),
rep("Costa Calida",5)))
color_med_atl=rev(brewer.pal(n=4,name="RdBu"))
p<-ggplot(data=data_pca,aes(x=PC1,y=PC2,label=INDIV))+
theme_minimal()+
theme(panel.grid=element_blank(),
panel.border=element_rect(fill="transparent"),
plot.title=element_text(hjust=0.5))+
geom_hline(yintercept=0,lty=2)+
geom_vline(xintercept=0,lty=2)+
geom_point(size=3,aes(col=LOCA))+
xlab(paste("PCA 1 (",round(pca$varprop[1]*100,2),"% )",sep=""))+
ylab(paste("PCA 2 (",round(pca$varprop[2]*100,2),"% )",sep=""))+
scale_colour_manual(name="Location",
values=c(color_med_atl[2],
color_med_atl[1],
color_med_atl[3],
color_med_atl[4]))
p1<-p
p<-ggplot(data=data_pca,aes(x=PC3,y=PC4,label=INDIV))+
theme_minimal()+
theme(panel.grid=element_blank(),
panel.border=element_rect(fill="transparent"),
plot.title=element_text(hjust=0.5))+
geom_hline(yintercept=0,lty=2)+
geom_vline(xintercept=0,lty=2)+
geom_point(size=3,aes(col=LOCA))+
xlab(paste("PCA 3 (",round(pca$varprop[3]*100,2),"% )",sep=""))+
ylab(paste("PCA 4 (",round(pca$varprop[4]*100,2),"% )",sep=""))+
scale_colour_manual(name="Location",
values=c(color_med_atl[2],
color_med_atl[1],
color_med_atl[3],
color_med_atl[4]))
p2<-p
data_varpop=data.frame(PC=factor(paste("P",seq(1,10),sep=""),levels=paste("P",seq(1,10),sep="")),VAR=pca$varprop[1:10])
pp<-ggplot(data_varpop,aes(x=PC,y=VAR))+
geom_bar(stat='identity',fill="dodgerblue2",alpha=0.25)+
theme_classic()+
xlab("Principal Component")+
ylab("Variation explained (%)")
```
```{r}
subplot(ggplotly(p1)%>% layout(legend = list(orientation = "h", x = 0.2, y =-0.15)), ggplotly(p2)%>%hide_legend(), ggplotly(pp)%>%hide_legend(), titleX=T,titleY=T,margin=0.035,widths=c(0.375,0.425,0.2),which_layout=1) %>% partial_bundle()
```
### maf = 0.50
```{r}
pca=PCA_list$All_filtered$maf0.5[[1]]
data_pca=data.frame(INDIV=pca$sample.id,
PC1=pca$eigenvect[,1],
PC2=pca$eigenvect[,2],
PC3=pca$eigenvect[,3],
PC4=pca$eigenvect[,4],
LOCA=c(rep("Algarve",5),
rep("Bay of Biscay",5),
rep("Gulf of Lion",5),
rep("Costa Calida",5)))
color_med_atl=rev(brewer.pal(n=4,name="RdBu"))
p<-ggplot(data=data_pca,aes(x=PC1,y=PC2,label=INDIV))+
theme_minimal()+
theme(panel.grid=element_blank(),
panel.border=element_rect(fill="transparent"),
plot.title=element_text(hjust=0.5))+
geom_hline(yintercept=0,lty=2)+
geom_vline(xintercept=0,lty=2)+
geom_point(size=3,aes(col=LOCA))+
xlab(paste("PCA 1 (",round(pca$varprop[1]*100,2),"% )",sep=""))+
ylab(paste("PCA 2 (",round(pca$varprop[2]*100,2),"% )",sep=""))+
scale_colour_manual(name="Location",
values=c(color_med_atl[2],
color_med_atl[1],
color_med_atl[3],
color_med_atl[4]))
p1<-p
p<-ggplot(data=data_pca,aes(x=PC3,y=PC4,label=INDIV))+
theme_minimal()+
theme(panel.grid=element_blank(),
panel.border=element_rect(fill="transparent"),
plot.title=element_text(hjust=0.5))+
geom_hline(yintercept=0,lty=2)+
geom_vline(xintercept=0,lty=2)+
geom_point(size=3,aes(col=LOCA))+
xlab(paste("PCA 3 (",round(pca$varprop[3]*100,2),"% )",sep=""))+
ylab(paste("PCA 4 (",round(pca$varprop[4]*100,2),"% )",sep=""))+
scale_colour_manual(name="Location",
values=c(color_med_atl[2],
color_med_atl[1],
color_med_atl[3],
color_med_atl[4]))
p2<-p
data_varpop=data.frame(PC=factor(paste("P",seq(1,10),sep=""),levels=paste("P",seq(1,10),sep="")),VAR=pca$varprop[1:10])
pp<-ggplot(data_varpop,aes(x=PC,y=VAR))+
geom_bar(stat='identity',fill="dodgerblue2",alpha=0.25)+
theme_classic()+
xlab("Principal Component")+
ylab("Variation explained (%)")
```
```{r}
subplot(ggplotly(p1)%>% layout(legend = list(orientation = "h", x = 0.2, y =-0.15)), ggplotly(p2)%>%hide_legend(), ggplotly(pp)%>%hide_legend(), titleX=T,titleY=T,margin=0.035,widths=c(0.375,0.425,0.2),which_layout=1) %>% partial_bundle()
```
Row {.tabset data-height=50}
-----------------------
<center>
<font size="6">**Pruned filtered SNPS**</font>
</center>
Row {.tabset data-height=600}
-----------------------
### maf = 0
```{r}
pca=PCA_list$Prune_filtered$maf0[[1]]
data_pca=data.frame(INDIV=pca$sample.id,
PC1=pca$eigenvect[,1],
PC2=pca$eigenvect[,2],
PC3=pca$eigenvect[,3],
PC4=pca$eigenvect[,4],
LOCA=c(rep("Algarve",5),
rep("Bay of Biscay",5),
rep("Gulf of Lion",5),
rep("Costa Calida",5)))
color_med_atl=rev(brewer.pal(n=4,name="RdBu"))
p<-ggplot(data=data_pca,aes(x=PC1,y=PC2,label=INDIV))+
theme_minimal()+
theme(panel.grid=element_blank(),
panel.border=element_rect(fill="transparent"),
plot.title=element_text(hjust=0.5))+
geom_hline(yintercept=0,lty=2)+
geom_vline(xintercept=0,lty=2)+
geom_point(size=3,aes(col=LOCA))+
xlab(paste("PCA 1 (",round(pca$varprop[1]*100,2),"% )",sep=""))+
ylab(paste("PCA 2 (",round(pca$varprop[2]*100,2),"% )",sep=""))+
scale_colour_manual(name="Location",
values=c(color_med_atl[2],
color_med_atl[1],
color_med_atl[3],
color_med_atl[4]))
p1<-p
p<-ggplot(data=data_pca,aes(x=PC3,y=PC4,label=INDIV))+
theme_minimal()+
theme(panel.grid=element_blank(),
panel.border=element_rect(fill="transparent"),
plot.title=element_text(hjust=0.5))+
geom_hline(yintercept=0,lty=2)+
geom_vline(xintercept=0,lty=2)+
geom_point(size=3,aes(col=LOCA))+
xlab(paste("PCA 3 (",round(pca$varprop[3]*100,2),"% )",sep=""))+
ylab(paste("PCA 4 (",round(pca$varprop[4]*100,2),"% )",sep=""))+
scale_colour_manual(name="Location",
values=c(color_med_atl[2],
color_med_atl[1],
color_med_atl[3],
color_med_atl[4]))
p2<-p
data_varpop=data.frame(PC=factor(paste("P",seq(1,10),sep=""),levels=paste("P",seq(1,10),sep="")),VAR=pca$varprop[1:10])
pp<-ggplot(data_varpop,aes(x=PC,y=VAR))+
geom_bar(stat='identity',fill="dodgerblue2",alpha=0.25)+
theme_classic()+
xlab("Principal Component")+
ylab("Variation explained (%)")
```
```{r}
subplot(ggplotly(p1)%>% layout(legend = list(orientation = "h", x = 0.2, y =-0.15)), ggplotly(p2)%>%hide_legend(), ggplotly(pp)%>%hide_legend(), titleX=T,titleY=T,margin=0.035,widths=c(0.375,0.425,0.2),which_layout=1) %>% partial_bundle()
```
### maf = 0.05
```{r}
pca=PCA_list$Prune_filtered$maf0.05[[1]]
data_pca=data.frame(INDIV=pca$sample.id,
PC1=pca$eigenvect[,1],
PC2=pca$eigenvect[,2],
PC3=pca$eigenvect[,3],
PC4=pca$eigenvect[,4],
LOCA=c(rep("Algarve",5),
rep("Bay of Biscay",5),
rep("Gulf of Lion",5),
rep("Costa Calida",5)))
color_med_atl=rev(brewer.pal(n=4,name="RdBu"))
p<-ggplot(data=data_pca,aes(x=PC1,y=PC2,label=INDIV))+
theme_minimal()+
theme(panel.grid=element_blank(),
panel.border=element_rect(fill="transparent"),
plot.title=element_text(hjust=0.5))+
geom_hline(yintercept=0,lty=2)+
geom_vline(xintercept=0,lty=2)+
geom_point(size=3,aes(col=LOCA))+
xlab(paste("PCA 1 (",round(pca$varprop[1]*100,2),"% )",sep=""))+
ylab(paste("PCA 2 (",round(pca$varprop[2]*100,2),"% )",sep=""))+
scale_colour_manual(name="Location",
values=c(color_med_atl[2],
color_med_atl[1],
color_med_atl[3],
color_med_atl[4]))
p1<-p
p<-ggplot(data=data_pca,aes(x=PC3,y=PC4,label=INDIV))+
theme_minimal()+
theme(panel.grid=element_blank(),
panel.border=element_rect(fill="transparent"),
plot.title=element_text(hjust=0.5))+
geom_hline(yintercept=0,lty=2)+
geom_vline(xintercept=0,lty=2)+
geom_point(size=3,aes(col=LOCA))+
xlab(paste("PCA 3 (",round(pca$varprop[3]*100,2),"% )",sep=""))+
ylab(paste("PCA 4 (",round(pca$varprop[4]*100,2),"% )",sep=""))+
scale_colour_manual(name="Location",
values=c(color_med_atl[2],
color_med_atl[1],
color_med_atl[3],
color_med_atl[4]))
p2<-p
data_varpop=data.frame(PC=factor(paste("P",seq(1,10),sep=""),levels=paste("P",seq(1,10),sep="")),VAR=pca$varprop[1:10])
pp<-ggplot(data_varpop,aes(x=PC,y=VAR))+
geom_bar(stat='identity',fill="dodgerblue2",alpha=0.25)+
theme_classic()+
xlab("Principal Component")+
ylab("Variation explained (%)")
```
```{r}
subplot(ggplotly(p1)%>% layout(legend = list(orientation = "h", x = 0.2, y =-0.15)), ggplotly(p2)%>%hide_legend(), ggplotly(pp)%>%hide_legend(), titleX=T,titleY=T,margin=0.035,widths=c(0.375,0.425,0.2),which_layout=1) %>% partial_bundle()
```
### maf = 0.1
```{r}
pca=PCA_list$Prune_filtered$maf0.1[[1]]
data_pca=data.frame(INDIV=pca$sample.id,
PC1=pca$eigenvect[,1],
PC2=pca$eigenvect[,2],
PC3=pca$eigenvect[,3],
PC4=pca$eigenvect[,4],
LOCA=c(rep("Algarve",5),
rep("Bay of Biscay",5),
rep("Gulf of Lion",5),
rep("Costa Calida",5)))
color_med_atl=rev(brewer.pal(n=4,name="RdBu"))
p<-ggplot(data=data_pca,aes(x=PC1,y=PC2,label=INDIV))+
theme_minimal()+
theme(panel.grid=element_blank(),
panel.border=element_rect(fill="transparent"),
plot.title=element_text(hjust=0.5))+
geom_hline(yintercept=0,lty=2)+
geom_vline(xintercept=0,lty=2)+
geom_point(size=3,aes(col=LOCA))+
xlab(paste("PCA 1 (",round(pca$varprop[1]*100,2),"% )",sep=""))+
ylab(paste("PCA 2 (",round(pca$varprop[2]*100,2),"% )",sep=""))+
scale_colour_manual(name="Location",
values=c(color_med_atl[2],
color_med_atl[1],
color_med_atl[3],
color_med_atl[4]))
p1<-p
p<-ggplot(data=data_pca,aes(x=PC3,y=PC4,label=INDIV))+
theme_minimal()+
theme(panel.grid=element_blank(),
panel.border=element_rect(fill="transparent"),
plot.title=element_text(hjust=0.5))+
geom_hline(yintercept=0,lty=2)+
geom_vline(xintercept=0,lty=2)+
geom_point(size=3,aes(col=LOCA))+
xlab(paste("PCA 3 (",round(pca$varprop[3]*100,2),"% )",sep=""))+
ylab(paste("PCA 4 (",round(pca$varprop[4]*100,2),"% )",sep=""))+
scale_colour_manual(name="Location",
values=c(color_med_atl[2],
color_med_atl[1],
color_med_atl[3],
color_med_atl[4]))
p2<-p
data_varpop=data.frame(PC=factor(paste("P",seq(1,10),sep=""),levels=paste("P",seq(1,10),sep="")),VAR=pca$varprop[1:10])
pp<-ggplot(data_varpop,aes(x=PC,y=VAR))+
geom_bar(stat='identity',fill="dodgerblue2",alpha=0.25)+
theme_classic()+
xlab("Principal Component")+
ylab("Variation explained (%)")
```
```{r}
subplot(ggplotly(p1)%>% layout(legend = list(orientation = "h", x = 0.2, y =-0.15)), ggplotly(p2)%>%hide_legend(), ggplotly(pp)%>%hide_legend(), titleX=T,titleY=T,margin=0.035,widths=c(0.375,0.425,0.2),which_layout=1) %>% partial_bundle()
```
### maf = 0.15
```{r}
pca=PCA_list$Prune_filtered$maf0.15[[1]]
data_pca=data.frame(INDIV=pca$sample.id,
PC1=pca$eigenvect[,1],
PC2=pca$eigenvect[,2],
PC3=pca$eigenvect[,3],
PC4=pca$eigenvect[,4],
LOCA=c(rep("Algarve",5),
rep("Bay of Biscay",5),
rep("Gulf of Lion",5),
rep("Costa Calida",5)))
color_med_atl=rev(brewer.pal(n=4,name="RdBu"))
p<-ggplot(data=data_pca,aes(x=PC1,y=PC2,label=INDIV))+
theme_minimal()+
theme(panel.grid=element_blank(),
panel.border=element_rect(fill="transparent"),
plot.title=element_text(hjust=0.5))+
geom_hline(yintercept=0,lty=2)+
geom_vline(xintercept=0,lty=2)+
geom_point(size=3,aes(col=LOCA))+
xlab(paste("PCA 1 (",round(pca$varprop[1]*100,2),"% )",sep=""))+
ylab(paste("PCA 2 (",round(pca$varprop[2]*100,2),"% )",sep=""))+
scale_colour_manual(name="Location",
values=c(color_med_atl[2],
color_med_atl[1],
color_med_atl[3],
color_med_atl[4]))
p1<-p
p<-ggplot(data=data_pca,aes(x=PC3,y=PC4,label=INDIV))+
theme_minimal()+
theme(panel.grid=element_blank(),
panel.border=element_rect(fill="transparent"),
plot.title=element_text(hjust=0.5))+
geom_hline(yintercept=0,lty=2)+
geom_vline(xintercept=0,lty=2)+
geom_point(size=3,aes(col=LOCA))+
xlab(paste("PCA 3 (",round(pca$varprop[3]*100,2),"% )",sep=""))+
ylab(paste("PCA 4 (",round(pca$varprop[4]*100,2),"% )",sep=""))+
scale_colour_manual(name="Location",
values=c(color_med_atl[2],
color_med_atl[1],
color_med_atl[3],
color_med_atl[4]))
p2<-p
data_varpop=data.frame(PC=factor(paste("P",seq(1,10),sep=""),levels=paste("P",seq(1,10),sep="")),VAR=pca$varprop[1:10])
pp<-ggplot(data_varpop,aes(x=PC,y=VAR))+
geom_bar(stat='identity',fill="dodgerblue2",alpha=0.25)+
theme_classic()+
xlab("Principal Component")+
ylab("Variation explained (%)")
```
```{r}
subplot(ggplotly(p1)%>% layout(legend = list(orientation = "h", x = 0.2, y =-0.15)), ggplotly(p2)%>%hide_legend(), ggplotly(pp)%>%hide_legend(), titleX=T,titleY=T,margin=0.035,widths=c(0.375,0.425,0.2),which_layout=1) %>% partial_bundle()
```
### maf = 0.20
```{r}
pca=PCA_list$Prune_filtered$maf0.2[[1]]
data_pca=data.frame(INDIV=pca$sample.id,
PC1=pca$eigenvect[,1],
PC2=pca$eigenvect[,2],
PC3=pca$eigenvect[,3],
PC4=pca$eigenvect[,4],
LOCA=c(rep("Algarve",5),
rep("Bay of Biscay",5),
rep("Gulf of Lion",5),
rep("Costa Calida",5)))
color_med_atl=rev(brewer.pal(n=4,name="RdBu"))
p<-ggplot(data=data_pca,aes(x=PC1,y=PC2,label=INDIV))+
theme_minimal()+
theme(panel.grid=element_blank(),
panel.border=element_rect(fill="transparent"),
plot.title=element_text(hjust=0.5))+
geom_hline(yintercept=0,lty=2)+
geom_vline(xintercept=0,lty=2)+
geom_point(size=3,aes(col=LOCA))+
xlab(paste("PCA 1 (",round(pca$varprop[1]*100,2),"% )",sep=""))+
ylab(paste("PCA 2 (",round(pca$varprop[2]*100,2),"% )",sep=""))+
scale_colour_manual(name="Location",
values=c(color_med_atl[2],
color_med_atl[1],
color_med_atl[3],
color_med_atl[4]))
p1<-p
p<-ggplot(data=data_pca,aes(x=PC3,y=PC4,label=INDIV))+
theme_minimal()+
theme(panel.grid=element_blank(),
panel.border=element_rect(fill="transparent"),
plot.title=element_text(hjust=0.5))+
geom_hline(yintercept=0,lty=2)+
geom_vline(xintercept=0,lty=2)+
geom_point(size=3,aes(col=LOCA))+
xlab(paste("PCA 3 (",round(pca$varprop[3]*100,2),"% )",sep=""))+
ylab(paste("PCA 4 (",round(pca$varprop[4]*100,2),"% )",sep=""))+
scale_colour_manual(name="Location",
values=c(color_med_atl[2],
color_med_atl[1],
color_med_atl[3],
color_med_atl[4]))
p2<-p
data_varpop=data.frame(PC=factor(paste("P",seq(1,10),sep=""),levels=paste("P",seq(1,10),sep="")),VAR=pca$varprop[1:10])
pp<-ggplot(data_varpop,aes(x=PC,y=VAR))+
geom_bar(stat='identity',fill="dodgerblue2",alpha=0.25)+
theme_classic()+
xlab("Principal Component")+
ylab("Variation explained (%)")
```
```{r}
subplot(ggplotly(p1)%>% layout(legend = list(orientation = "h", x = 0.2, y =-0.15)), ggplotly(p2)%>%hide_legend(), ggplotly(pp)%>%hide_legend(), titleX=T,titleY=T,margin=0.035,widths=c(0.375,0.425,0.2),which_layout=1) %>% partial_bundle()
```
### maf = 0.25
```{r}
pca=PCA_list$Prune_filtered$maf0.25[[1]]
data_pca=data.frame(INDIV=pca$sample.id,
PC1=pca$eigenvect[,1],
PC2=pca$eigenvect[,2],
PC3=pca$eigenvect[,3],
PC4=pca$eigenvect[,4],
LOCA=c(rep("Algarve",5),
rep("Bay of Biscay",5),
rep("Gulf of Lion",5),
rep("Costa Calida",5)))
color_med_atl=rev(brewer.pal(n=4,name="RdBu"))
p<-ggplot(data=data_pca,aes(x=PC1,y=PC2,label=INDIV))+
theme_minimal()+
theme(panel.grid=element_blank(),
panel.border=element_rect(fill="transparent"),
plot.title=element_text(hjust=0.5))+
geom_hline(yintercept=0,lty=2)+
geom_vline(xintercept=0,lty=2)+
geom_point(size=3,aes(col=LOCA))+
xlab(paste("PCA 1 (",round(pca$varprop[1]*100,2),"% )",sep=""))+
ylab(paste("PCA 2 (",round(pca$varprop[2]*100,2),"% )",sep=""))+
scale_colour_manual(name="Location",
values=c(color_med_atl[2],
color_med_atl[1],
color_med_atl[3],
color_med_atl[4]))
p1<-p
p<-ggplot(data=data_pca,aes(x=PC3,y=PC4,label=INDIV))+
theme_minimal()+
theme(panel.grid=element_blank(),
panel.border=element_rect(fill="transparent"),
plot.title=element_text(hjust=0.5))+
geom_hline(yintercept=0,lty=2)+
geom_vline(xintercept=0,lty=2)+
geom_point(size=3,aes(col=LOCA))+
xlab(paste("PCA 3 (",round(pca$varprop[3]*100,2),"% )",sep=""))+
ylab(paste("PCA 4 (",round(pca$varprop[4]*100,2),"% )",sep=""))+
scale_colour_manual(name="Location",
values=c(color_med_atl[2],
color_med_atl[1],
color_med_atl[3],
color_med_atl[4]))
p2<-p
data_varpop=data.frame(PC=factor(paste("P",seq(1,10),sep=""),levels=paste("P",seq(1,10),sep="")),VAR=pca$varprop[1:10])
pp<-ggplot(data_varpop,aes(x=PC,y=VAR))+
geom_bar(stat='identity',fill="dodgerblue2",alpha=0.25)+
theme_classic()+
xlab("Principal Component")+
ylab("Variation explained (%)")
```
```{r}
subplot(ggplotly(p1)%>% layout(legend = list(orientation = "h", x = 0.2, y =-0.15)), ggplotly(p2)%>%hide_legend(), ggplotly(pp)%>%hide_legend(), titleX=T,titleY=T,margin=0.035,widths=c(0.375,0.425,0.2),which_layout=1) %>% partial_bundle()
```
### maf = 0.30
```{r}
pca=PCA_list$Prune_filtered$maf0.3[[1]]
data_pca=data.frame(INDIV=pca$sample.id,
PC1=pca$eigenvect[,1],
PC2=pca$eigenvect[,2],
PC3=pca$eigenvect[,3],
PC4=pca$eigenvect[,4],
LOCA=c(rep("Algarve",5),
rep("Bay of Biscay",5),
rep("Gulf of Lion",5),
rep("Costa Calida",5)))
color_med_atl=rev(brewer.pal(n=4,name="RdBu"))
p<-ggplot(data=data_pca,aes(x=PC1,y=PC2,label=INDIV))+
theme_minimal()+
theme(panel.grid=element_blank(),
panel.border=element_rect(fill="transparent"),
plot.title=element_text(hjust=0.5))+
geom_hline(yintercept=0,lty=2)+
geom_vline(xintercept=0,lty=2)+
geom_point(size=3,aes(col=LOCA))+
xlab(paste("PCA 1 (",round(pca$varprop[1]*100,2),"% )",sep=""))+
ylab(paste("PCA 2 (",round(pca$varprop[2]*100,2),"% )",sep=""))+
scale_colour_manual(name="Location",
values=c(color_med_atl[2],
color_med_atl[1],
color_med_atl[3],
color_med_atl[4]))
p1<-p
p<-ggplot(data=data_pca,aes(x=PC3,y=PC4,label=INDIV))+
theme_minimal()+
theme(panel.grid=element_blank(),
panel.border=element_rect(fill="transparent"),
plot.title=element_text(hjust=0.5))+
geom_hline(yintercept=0,lty=2)+
geom_vline(xintercept=0,lty=2)+
geom_point(size=3,aes(col=LOCA))+
xlab(paste("PCA 3 (",round(pca$varprop[3]*100,2),"% )",sep=""))+
ylab(paste("PCA 4 (",round(pca$varprop[4]*100,2),"% )",sep=""))+
scale_colour_manual(name="Location",
values=c(color_med_atl[2],
color_med_atl[1],
color_med_atl[3],
color_med_atl[4]))
p2<-p
data_varpop=data.frame(PC=factor(paste("P",seq(1,10),sep=""),levels=paste("P",seq(1,10),sep="")),VAR=pca$varprop[1:10])
pp<-ggplot(data_varpop,aes(x=PC,y=VAR))+
geom_bar(stat='identity',fill="dodgerblue2",alpha=0.25)+
theme_classic()+
xlab("Principal Component")+
ylab("Variation explained (%)")
```
```{r}
subplot(ggplotly(p1)%>% layout(legend = list(orientation = "h", x = 0.2, y =-0.15)), ggplotly(p2)%>%hide_legend(), ggplotly(pp)%>%hide_legend(), titleX=T,titleY=T,margin=0.035,widths=c(0.375,0.425,0.2),which_layout=1) %>% partial_bundle()
```
### maf = 0.35
```{r}
pca=PCA_list$Prune_filtered$maf0.35[[1]]
data_pca=data.frame(INDIV=pca$sample.id,
PC1=pca$eigenvect[,1],
PC2=pca$eigenvect[,2],
PC3=pca$eigenvect[,3],
PC4=pca$eigenvect[,4],
LOCA=c(rep("Algarve",5),
rep("Bay of Biscay",5),
rep("Gulf of Lion",5),
rep("Costa Calida",5)))
color_med_atl=rev(brewer.pal(n=4,name="RdBu"))
p<-ggplot(data=data_pca,aes(x=PC1,y=PC2,label=INDIV))+
theme_minimal()+
theme(panel.grid=element_blank(),
panel.border=element_rect(fill="transparent"),
plot.title=element_text(hjust=0.5))+
geom_hline(yintercept=0,lty=2)+
geom_vline(xintercept=0,lty=2)+
geom_point(size=3,aes(col=LOCA))+
xlab(paste("PCA 1 (",round(pca$varprop[1]*100,2),"% )",sep=""))+
ylab(paste("PCA 2 (",round(pca$varprop[2]*100,2),"% )",sep=""))+
scale_colour_manual(name="Location",
values=c(color_med_atl[2],
color_med_atl[1],
color_med_atl[3],
color_med_atl[4]))
p1<-p
p<-ggplot(data=data_pca,aes(x=PC3,y=PC4,label=INDIV))+
theme_minimal()+
theme(panel.grid=element_blank(),
panel.border=element_rect(fill="transparent"),
plot.title=element_text(hjust=0.5))+
geom_hline(yintercept=0,lty=2)+
geom_vline(xintercept=0,lty=2)+
geom_point(size=3,aes(col=LOCA))+
xlab(paste("PCA 3 (",round(pca$varprop[3]*100,2),"% )",sep=""))+
ylab(paste("PCA 4 (",round(pca$varprop[4]*100,2),"% )",sep=""))+
scale_colour_manual(name="Location",
values=c(color_med_atl[2],
color_med_atl[1],
color_med_atl[3],
color_med_atl[4]))
p2<-p
data_varpop=data.frame(PC=factor(paste("P",seq(1,10),sep=""),levels=paste("P",seq(1,10),sep="")),VAR=pca$varprop[1:10])
pp<-ggplot(data_varpop,aes(x=PC,y=VAR))+
geom_bar(stat='identity',fill="dodgerblue2",alpha=0.25)+
theme_classic()+
xlab("Principal Component")+
ylab("Variation explained (%)")
```
```{r}
subplot(ggplotly(p1)%>% layout(legend = list(orientation = "h", x = 0.2, y =-0.15)), ggplotly(p2)%>%hide_legend(), ggplotly(pp)%>%hide_legend(), titleX=T,titleY=T,margin=0.035,widths=c(0.375,0.425,0.2),which_layout=1) %>% partial_bundle()
```
### maf = 0.40
```{r}
pca=PCA_list$Prune_filtered$maf0.4[[1]]
data_pca=data.frame(INDIV=pca$sample.id,
PC1=pca$eigenvect[,1],
PC2=pca$eigenvect[,2],
PC3=pca$eigenvect[,3],
PC4=pca$eigenvect[,4],
LOCA=c(rep("Algarve",5),
rep("Bay of Biscay",5),
rep("Gulf of Lion",5),
rep("Costa Calida",5)))
color_med_atl=rev(brewer.pal(n=4,name="RdBu"))
p<-ggplot(data=data_pca,aes(x=PC1,y=PC2,label=INDIV))+
theme_minimal()+
theme(panel.grid=element_blank(),
panel.border=element_rect(fill="transparent"),
plot.title=element_text(hjust=0.5))+
geom_hline(yintercept=0,lty=2)+
geom_vline(xintercept=0,lty=2)+
geom_point(size=3,aes(col=LOCA))+
xlab(paste("PCA 1 (",round(pca$varprop[1]*100,2),"% )",sep=""))+
ylab(paste("PCA 2 (",round(pca$varprop[2]*100,2),"% )",sep=""))+
scale_colour_manual(name="Location",
values=c(color_med_atl[2],
color_med_atl[1],
color_med_atl[3],
color_med_atl[4]))
p1<-p
p<-ggplot(data=data_pca,aes(x=PC3,y=PC4,label=INDIV))+
theme_minimal()+
theme(panel.grid=element_blank(),
panel.border=element_rect(fill="transparent"),
plot.title=element_text(hjust=0.5))+
geom_hline(yintercept=0,lty=2)+
geom_vline(xintercept=0,lty=2)+
geom_point(size=3,aes(col=LOCA))+
xlab(paste("PCA 3 (",round(pca$varprop[3]*100,2),"% )",sep=""))+
ylab(paste("PCA 4 (",round(pca$varprop[4]*100,2),"% )",sep=""))+
scale_colour_manual(name="Location",
values=c(color_med_atl[2],
color_med_atl[1],
color_med_atl[3],
color_med_atl[4]))
p2<-p
data_varpop=data.frame(PC=factor(paste("P",seq(1,10),sep=""),levels=paste("P",seq(1,10),sep="")),VAR=pca$varprop[1:10])
pp<-ggplot(data_varpop,aes(x=PC,y=VAR))+
geom_bar(stat='identity',fill="dodgerblue2",alpha=0.25)+
theme_classic()+
xlab("Principal Component")+
ylab("Variation explained (%)")
```
```{r}
subplot(ggplotly(p1)%>% layout(legend = list(orientation = "h", x = 0.2, y =-0.15)), ggplotly(p2)%>%hide_legend(), ggplotly(pp)%>%hide_legend(), titleX=T,titleY=T,margin=0.035,widths=c(0.375,0.425,0.2),which_layout=1) %>% partial_bundle()
```
### maf = 0.45
```{r}
pca=PCA_list$Prune_filtered$maf0.45[[1]]
data_pca=data.frame(INDIV=pca$sample.id,
PC1=pca$eigenvect[,1],
PC2=pca$eigenvect[,2],
PC3=pca$eigenvect[,3],
PC4=pca$eigenvect[,4],
LOCA=c(rep("Algarve",5),
rep("Bay of Biscay",5),
rep("Gulf of Lion",5),
rep("Costa Calida",5)))
color_med_atl=rev(brewer.pal(n=4,name="RdBu"))
p<-ggplot(data=data_pca,aes(x=PC1,y=PC2,label=INDIV))+
theme_minimal()+
theme(panel.grid=element_blank(),
panel.border=element_rect(fill="transparent"),
plot.title=element_text(hjust=0.5))+
geom_hline(yintercept=0,lty=2)+
geom_vline(xintercept=0,lty=2)+
geom_point(size=3,aes(col=LOCA))+
xlab(paste("PCA 1 (",round(pca$varprop[1]*100,2),"% )",sep=""))+
ylab(paste("PCA 2 (",round(pca$varprop[2]*100,2),"% )",sep=""))+
scale_colour_manual(name="Location",
values=c(color_med_atl[2],
color_med_atl[1],
color_med_atl[3],
color_med_atl[4]))
p1<-p
p<-ggplot(data=data_pca,aes(x=PC3,y=PC4,label=INDIV))+
theme_minimal()+
theme(panel.grid=element_blank(),
panel.border=element_rect(fill="transparent"),
plot.title=element_text(hjust=0.5))+
geom_hline(yintercept=0,lty=2)+
geom_vline(xintercept=0,lty=2)+
geom_point(size=3,aes(col=LOCA))+
xlab(paste("PCA 3 (",round(pca$varprop[3]*100,2),"% )",sep=""))+
ylab(paste("PCA 4 (",round(pca$varprop[4]*100,2),"% )",sep=""))+
scale_colour_manual(name="Location",
values=c(color_med_atl[2],
color_med_atl[1],
color_med_atl[3],
color_med_atl[4]))
p2<-p
data_varpop=data.frame(PC=factor(paste("P",seq(1,10),sep=""),levels=paste("P",seq(1,10),sep="")),VAR=pca$varprop[1:10])
pp<-ggplot(data_varpop,aes(x=PC,y=VAR))+
geom_bar(stat='identity',fill="dodgerblue2",alpha=0.25)+
theme_classic()+
xlab("Principal Component")+
ylab("Variation explained (%)")
```
```{r}
subplot(ggplotly(p1)%>% layout(legend = list(orientation = "h", x = 0.2, y =-0.15)), ggplotly(p2)%>%hide_legend(), ggplotly(pp)%>%hide_legend(), titleX=T,titleY=T,margin=0.035,widths=c(0.375,0.425,0.2),which_layout=1) %>% partial_bundle()
```
### maf = 0.50
```{r}
pca=PCA_list$Prune_filtered$maf0.5[[1]]
data_pca=data.frame(INDIV=pca$sample.id,
PC1=pca$eigenvect[,1],
PC2=pca$eigenvect[,2],
PC3=pca$eigenvect[,3],
PC4=pca$eigenvect[,4],
LOCA=c(rep("Algarve",5),
rep("Bay of Biscay",5),
rep("Gulf of Lion",5),
rep("Costa Calida",5)))
color_med_atl=rev(brewer.pal(n=4,name="RdBu"))
p<-ggplot(data=data_pca,aes(x=PC1,y=PC2,label=INDIV))+
theme_minimal()+
theme(panel.grid=element_blank(),
panel.border=element_rect(fill="transparent"),
plot.title=element_text(hjust=0.5))+
geom_hline(yintercept=0,lty=2)+
geom_vline(xintercept=0,lty=2)+
geom_point(size=3,aes(col=LOCA))+
xlab(paste("PCA 1 (",round(pca$varprop[1]*100,2),"% )",sep=""))+
ylab(paste("PCA 2 (",round(pca$varprop[2]*100,2),"% )",sep=""))+
scale_colour_manual(name="Location",
values=c(color_med_atl[2],
color_med_atl[1],
color_med_atl[3],
color_med_atl[4]))
p1<-p
p<-ggplot(data=data_pca,aes(x=PC3,y=PC4,label=INDIV))+
theme_minimal()+
theme(panel.grid=element_blank(),
panel.border=element_rect(fill="transparent"),
plot.title=element_text(hjust=0.5))+
geom_hline(yintercept=0,lty=2)+
geom_vline(xintercept=0,lty=2)+
geom_point(size=3,aes(col=LOCA))+
xlab(paste("PCA 3 (",round(pca$varprop[3]*100,2),"% )",sep=""))+
ylab(paste("PCA 4 (",round(pca$varprop[4]*100,2),"% )",sep=""))+
scale_colour_manual(name="Location",
values=c(color_med_atl[2],
color_med_atl[1],
color_med_atl[3],
color_med_atl[4]))
p2<-p
data_varpop=data.frame(PC=factor(paste("P",seq(1,10),sep=""),levels=paste("P",seq(1,10),sep="")),VAR=pca$varprop[1:10])
pp<-ggplot(data_varpop,aes(x=PC,y=VAR))+
geom_bar(stat='identity',fill="dodgerblue2",alpha=0.25)+
theme_classic()+
xlab("Principal Component")+
ylab("Variation explained (%)")
```
```{r}
subplot(ggplotly(p1)%>% layout(legend = list(orientation = "h", x = 0.2, y =-0.15)), ggplotly(p2)%>%hide_legend(), ggplotly(pp)%>%hide_legend(), titleX=T,titleY=T,margin=0.035,widths=c(0.375,0.425,0.2),which_layout=1) %>% partial_bundle()
```
Row {.tabset data-height=50}
-----------------------
<center>
<font size="6">**All unfiltered SNPS**</font>
</center>
Row {.tabset data-height=600}
-----------------------
### maf = 0
```{r}
pca=PCA_list$All_unfiltered$maf0[[1]]
data_pca=data.frame(INDIV=pca$sample.id,
PC1=pca$eigenvect[,1],
PC2=pca$eigenvect[,2],
PC3=pca$eigenvect[,3],
PC4=pca$eigenvect[,4],
LOCA=c(rep("Algarve",5),
rep("Bay of Biscay",5),
rep("Gulf of Lion",5),
rep("Costa Calida",5)))
color_med_atl=rev(brewer.pal(n=4,name="RdBu"))
p<-ggplot(data=data_pca,aes(x=PC1,y=PC2,label=INDIV))+
theme_minimal()+
theme(panel.grid=element_blank(),
panel.border=element_rect(fill="transparent"),
plot.title=element_text(hjust=0.5))+
geom_hline(yintercept=0,lty=2)+
geom_vline(xintercept=0,lty=2)+
geom_point(size=3,aes(col=LOCA))+
xlab(paste("PCA 1 (",round(pca$varprop[1]*100,2),"% )",sep=""))+
ylab(paste("PCA 2 (",round(pca$varprop[2]*100,2),"% )",sep=""))+
scale_colour_manual(name="Location",
values=c(color_med_atl[2],
color_med_atl[1],
color_med_atl[3],
color_med_atl[4]))
p1<-p
p<-ggplot(data=data_pca,aes(x=PC3,y=PC4,label=INDIV))+
theme_minimal()+
theme(panel.grid=element_blank(),
panel.border=element_rect(fill="transparent"),
plot.title=element_text(hjust=0.5))+
geom_hline(yintercept=0,lty=2)+
geom_vline(xintercept=0,lty=2)+
geom_point(size=3,aes(col=LOCA))+
xlab(paste("PCA 3 (",round(pca$varprop[3]*100,2),"% )",sep=""))+
ylab(paste("PCA 4 (",round(pca$varprop[4]*100,2),"% )",sep=""))+
scale_colour_manual(name="Location",
values=c(color_med_atl[2],
color_med_atl[1],
color_med_atl[3],
color_med_atl[4]))
p2<-p
data_varpop=data.frame(PC=factor(paste("P",seq(1,10),sep=""),levels=paste("P",seq(1,10),sep="")),VAR=pca$varprop[1:10])
pp<-ggplot(data_varpop,aes(x=PC,y=VAR))+
geom_bar(stat='identity',fill="dodgerblue2",alpha=0.25)+
theme_classic()+
xlab("Principal Component")+
ylab("Variation explained (%)")
```
```{r}
subplot(ggplotly(p1)%>% layout(legend = list(orientation = "h", x = 0.2, y =-0.15)), ggplotly(p2)%>%hide_legend(), ggplotly(pp)%>%hide_legend(), titleX=T,titleY=T,margin=0.035,widths=c(0.375,0.425,0.2),which_layout=1) %>% partial_bundle()
```
### maf = 0.05
```{r}
pca=PCA_list$All_unfiltered$maf0.05[[1]]
data_pca=data.frame(INDIV=pca$sample.id,
PC1=pca$eigenvect[,1],
PC2=pca$eigenvect[,2],
PC3=pca$eigenvect[,3],
PC4=pca$eigenvect[,4],
LOCA=c(rep("Algarve",5),
rep("Bay of Biscay",5),
rep("Gulf of Lion",5),
rep("Costa Calida",5)))
color_med_atl=rev(brewer.pal(n=4,name="RdBu"))
p<-ggplot(data=data_pca,aes(x=PC1,y=PC2,label=INDIV))+
theme_minimal()+
theme(panel.grid=element_blank(),
panel.border=element_rect(fill="transparent"),
plot.title=element_text(hjust=0.5))+
geom_hline(yintercept=0,lty=2)+
geom_vline(xintercept=0,lty=2)+
geom_point(size=3,aes(col=LOCA))+
xlab(paste("PCA 1 (",round(pca$varprop[1]*100,2),"% )",sep=""))+
ylab(paste("PCA 2 (",round(pca$varprop[2]*100,2),"% )",sep=""))+
scale_colour_manual(name="Location",
values=c(color_med_atl[2],
color_med_atl[1],
color_med_atl[3],
color_med_atl[4]))
p1<-p
p<-ggplot(data=data_pca,aes(x=PC3,y=PC4,label=INDIV))+
theme_minimal()+
theme(panel.grid=element_blank(),
panel.border=element_rect(fill="transparent"),
plot.title=element_text(hjust=0.5))+
geom_hline(yintercept=0,lty=2)+
geom_vline(xintercept=0,lty=2)+
geom_point(size=3,aes(col=LOCA))+
xlab(paste("PCA 3 (",round(pca$varprop[3]*100,2),"% )",sep=""))+
ylab(paste("PCA 4 (",round(pca$varprop[4]*100,2),"% )",sep=""))+
scale_colour_manual(name="Location",
values=c(color_med_atl[2],
color_med_atl[1],
color_med_atl[3],
color_med_atl[4]))
p2<-p
data_varpop=data.frame(PC=factor(paste("P",seq(1,10),sep=""),levels=paste("P",seq(1,10),sep="")),VAR=pca$varprop[1:10])
pp<-ggplot(data_varpop,aes(x=PC,y=VAR))+
geom_bar(stat='identity',fill="dodgerblue2",alpha=0.25)+
theme_classic()+
xlab("Principal Component")+
ylab("Variation explained (%)")
```
```{r}
subplot(ggplotly(p1)%>% layout(legend = list(orientation = "h", x = 0.2, y =-0.15)), ggplotly(p2)%>%hide_legend(), ggplotly(pp)%>%hide_legend(), titleX=T,titleY=T,margin=0.035,widths=c(0.375,0.425,0.2),which_layout=1) %>% partial_bundle()
```
### maf = 0.1
```{r}
pca=PCA_list$All_unfiltered$maf0.1[[1]]
data_pca=data.frame(INDIV=pca$sample.id,
PC1=pca$eigenvect[,1],
PC2=pca$eigenvect[,2],
PC3=pca$eigenvect[,3],
PC4=pca$eigenvect[,4],
LOCA=c(rep("Algarve",5),
rep("Bay of Biscay",5),
rep("Gulf of Lion",5),
rep("Costa Calida",5)))
color_med_atl=rev(brewer.pal(n=4,name="RdBu"))
p<-ggplot(data=data_pca,aes(x=PC1,y=PC2,label=INDIV))+
theme_minimal()+
theme(panel.grid=element_blank(),
panel.border=element_rect(fill="transparent"),
plot.title=element_text(hjust=0.5))+
geom_hline(yintercept=0,lty=2)+
geom_vline(xintercept=0,lty=2)+
geom_point(size=3,aes(col=LOCA))+
xlab(paste("PCA 1 (",round(pca$varprop[1]*100,2),"% )",sep=""))+
ylab(paste("PCA 2 (",round(pca$varprop[2]*100,2),"% )",sep=""))+
scale_colour_manual(name="Location",
values=c(color_med_atl[2],
color_med_atl[1],
color_med_atl[3],
color_med_atl[4]))
p1<-p
p<-ggplot(data=data_pca,aes(x=PC3,y=PC4,label=INDIV))+
theme_minimal()+
theme(panel.grid=element_blank(),
panel.border=element_rect(fill="transparent"),
plot.title=element_text(hjust=0.5))+
geom_hline(yintercept=0,lty=2)+
geom_vline(xintercept=0,lty=2)+
geom_point(size=3,aes(col=LOCA))+
xlab(paste("PCA 3 (",round(pca$varprop[3]*100,2),"% )",sep=""))+
ylab(paste("PCA 4 (",round(pca$varprop[4]*100,2),"% )",sep=""))+
scale_colour_manual(name="Location",
values=c(color_med_atl[2],
color_med_atl[1],
color_med_atl[3],
color_med_atl[4]))
p2<-p
data_varpop=data.frame(PC=factor(paste("P",seq(1,10),sep=""),levels=paste("P",seq(1,10),sep="")),VAR=pca$varprop[1:10])
pp<-ggplot(data_varpop,aes(x=PC,y=VAR))+
geom_bar(stat='identity',fill="dodgerblue2",alpha=0.25)+
theme_classic()+
xlab("Principal Component")+
ylab("Variation explained (%)")
```
```{r}
subplot(ggplotly(p1)%>% layout(legend = list(orientation = "h", x = 0.2, y =-0.15)), ggplotly(p2)%>%hide_legend(), ggplotly(pp)%>%hide_legend(), titleX=T,titleY=T,margin=0.035,widths=c(0.375,0.425,0.2),which_layout=1) %>% partial_bundle()
```
### maf = 0.15
```{r}
pca=PCA_list$All_unfiltered$maf0.15[[1]]
data_pca=data.frame(INDIV=pca$sample.id,
PC1=pca$eigenvect[,1],
PC2=pca$eigenvect[,2],
PC3=pca$eigenvect[,3],
PC4=pca$eigenvect[,4],
LOCA=c(rep("Algarve",5),
rep("Bay of Biscay",5),
rep("Gulf of Lion",5),
rep("Costa Calida",5)))
color_med_atl=rev(brewer.pal(n=4,name="RdBu"))
p<-ggplot(data=data_pca,aes(x=PC1,y=PC2,label=INDIV))+
theme_minimal()+
theme(panel.grid=element_blank(),
panel.border=element_rect(fill="transparent"),
plot.title=element_text(hjust=0.5))+
geom_hline(yintercept=0,lty=2)+
geom_vline(xintercept=0,lty=2)+
geom_point(size=3,aes(col=LOCA))+
xlab(paste("PCA 1 (",round(pca$varprop[1]*100,2),"% )",sep=""))+
ylab(paste("PCA 2 (",round(pca$varprop[2]*100,2),"% )",sep=""))+
scale_colour_manual(name="Location",
values=c(color_med_atl[2],
color_med_atl[1],
color_med_atl[3],
color_med_atl[4]))
p1<-p
p<-ggplot(data=data_pca,aes(x=PC3,y=PC4,label=INDIV))+
theme_minimal()+
theme(panel.grid=element_blank(),
panel.border=element_rect(fill="transparent"),
plot.title=element_text(hjust=0.5))+
geom_hline(yintercept=0,lty=2)+
geom_vline(xintercept=0,lty=2)+
geom_point(size=3,aes(col=LOCA))+
xlab(paste("PCA 3 (",round(pca$varprop[3]*100,2),"% )",sep=""))+
ylab(paste("PCA 4 (",round(pca$varprop[4]*100,2),"% )",sep=""))+
scale_colour_manual(name="Location",
values=c(color_med_atl[2],
color_med_atl[1],
color_med_atl[3],
color_med_atl[4]))
p2<-p
data_varpop=data.frame(PC=factor(paste("P",seq(1,10),sep=""),levels=paste("P",seq(1,10),sep="")),VAR=pca$varprop[1:10])
pp<-ggplot(data_varpop,aes(x=PC,y=VAR))+
geom_bar(stat='identity',fill="dodgerblue2",alpha=0.25)+
theme_classic()+
xlab("Principal Component")+
ylab("Variation explained (%)")
```
```{r}
subplot(ggplotly(p1)%>% layout(legend = list(orientation = "h", x = 0.2, y =-0.15)), ggplotly(p2)%>%hide_legend(), ggplotly(pp)%>%hide_legend(), titleX=T,titleY=T,margin=0.035,widths=c(0.375,0.425,0.2),which_layout=1) %>% partial_bundle()
```
### maf = 0.20
```{r}
pca=PCA_list$All_unfiltered$maf0.2[[1]]
data_pca=data.frame(INDIV=pca$sample.id,
PC1=pca$eigenvect[,1],
PC2=pca$eigenvect[,2],
PC3=pca$eigenvect[,3],
PC4=pca$eigenvect[,4],
LOCA=c(rep("Algarve",5),
rep("Bay of Biscay",5),
rep("Gulf of Lion",5),
rep("Costa Calida",5)))
color_med_atl=rev(brewer.pal(n=4,name="RdBu"))
p<-ggplot(data=data_pca,aes(x=PC1,y=PC2,label=INDIV))+
theme_minimal()+
theme(panel.grid=element_blank(),
panel.border=element_rect(fill="transparent"),
plot.title=element_text(hjust=0.5))+
geom_hline(yintercept=0,lty=2)+
geom_vline(xintercept=0,lty=2)+
geom_point(size=3,aes(col=LOCA))+
xlab(paste("PCA 1 (",round(pca$varprop[1]*100,2),"% )",sep=""))+
ylab(paste("PCA 2 (",round(pca$varprop[2]*100,2),"% )",sep=""))+
scale_colour_manual(name="Location",
values=c(color_med_atl[2],
color_med_atl[1],
color_med_atl[3],
color_med_atl[4]))
p1<-p
p<-ggplot(data=data_pca,aes(x=PC3,y=PC4,label=INDIV))+
theme_minimal()+
theme(panel.grid=element_blank(),
panel.border=element_rect(fill="transparent"),
plot.title=element_text(hjust=0.5))+
geom_hline(yintercept=0,lty=2)+
geom_vline(xintercept=0,lty=2)+
geom_point(size=3,aes(col=LOCA))+
xlab(paste("PCA 3 (",round(pca$varprop[3]*100,2),"% )",sep=""))+
ylab(paste("PCA 4 (",round(pca$varprop[4]*100,2),"% )",sep=""))+
scale_colour_manual(name="Location",
values=c(color_med_atl[2],
color_med_atl[1],
color_med_atl[3],
color_med_atl[4]))
p2<-p
data_varpop=data.frame(PC=factor(paste("P",seq(1,10),sep=""),levels=paste("P",seq(1,10),sep="")),VAR=pca$varprop[1:10])
pp<-ggplot(data_varpop,aes(x=PC,y=VAR))+
geom_bar(stat='identity',fill="dodgerblue2",alpha=0.25)+
theme_classic()+
xlab("Principal Component")+
ylab("Variation explained (%)")
```
```{r}
subplot(ggplotly(p1)%>% layout(legend = list(orientation = "h", x = 0.2, y =-0.15)), ggplotly(p2)%>%hide_legend(), ggplotly(pp)%>%hide_legend(), titleX=T,titleY=T,margin=0.035,widths=c(0.375,0.425,0.2),which_layout=1) %>% partial_bundle()
```
### maf = 0.25
```{r}
pca=PCA_list$All_unfiltered$maf0.25[[1]]
data_pca=data.frame(INDIV=pca$sample.id,
PC1=pca$eigenvect[,1],
PC2=pca$eigenvect[,2],
PC3=pca$eigenvect[,3],
PC4=pca$eigenvect[,4],
LOCA=c(rep("Algarve",5),
rep("Bay of Biscay",5),
rep("Gulf of Lion",5),
rep("Costa Calida",5)))
color_med_atl=rev(brewer.pal(n=4,name="RdBu"))
p<-ggplot(data=data_pca,aes(x=PC1,y=PC2,label=INDIV))+
theme_minimal()+
theme(panel.grid=element_blank(),
panel.border=element_rect(fill="transparent"),
plot.title=element_text(hjust=0.5))+
geom_hline(yintercept=0,lty=2)+
geom_vline(xintercept=0,lty=2)+
geom_point(size=3,aes(col=LOCA))+
xlab(paste("PCA 1 (",round(pca$varprop[1]*100,2),"% )",sep=""))+
ylab(paste("PCA 2 (",round(pca$varprop[2]*100,2),"% )",sep=""))+
scale_colour_manual(name="Location",
values=c(color_med_atl[2],
color_med_atl[1],
color_med_atl[3],
color_med_atl[4]))
p1<-p
p<-ggplot(data=data_pca,aes(x=PC3,y=PC4,label=INDIV))+
theme_minimal()+
theme(panel.grid=element_blank(),
panel.border=element_rect(fill="transparent"),
plot.title=element_text(hjust=0.5))+
geom_hline(yintercept=0,lty=2)+
geom_vline(xintercept=0,lty=2)+
geom_point(size=3,aes(col=LOCA))+
xlab(paste("PCA 3 (",round(pca$varprop[3]*100,2),"% )",sep=""))+
ylab(paste("PCA 4 (",round(pca$varprop[4]*100,2),"% )",sep=""))+
scale_colour_manual(name="Location",
values=c(color_med_atl[2],
color_med_atl[1],
color_med_atl[3],
color_med_atl[4]))
p2<-p
data_varpop=data.frame(PC=factor(paste("P",seq(1,10),sep=""),levels=paste("P",seq(1,10),sep="")),VAR=pca$varprop[1:10])
pp<-ggplot(data_varpop,aes(x=PC,y=VAR))+
geom_bar(stat='identity',fill="dodgerblue2",alpha=0.25)+
theme_classic()+
xlab("Principal Component")+
ylab("Variation explained (%)")
```
```{r}
subplot(ggplotly(p1)%>% layout(legend = list(orientation = "h", x = 0.2, y =-0.15)), ggplotly(p2)%>%hide_legend(), ggplotly(pp)%>%hide_legend(), titleX=T,titleY=T,margin=0.035,widths=c(0.375,0.425,0.2),which_layout=1) %>% partial_bundle()
```
### maf = 0.30
```{r}
pca=PCA_list$All_unfiltered$maf0.3[[1]]
data_pca=data.frame(INDIV=pca$sample.id,
PC1=pca$eigenvect[,1],
PC2=pca$eigenvect[,2],
PC3=pca$eigenvect[,3],
PC4=pca$eigenvect[,4],
LOCA=c(rep("Algarve",5),
rep("Bay of Biscay",5),
rep("Gulf of Lion",5),
rep("Costa Calida",5)))
color_med_atl=rev(brewer.pal(n=4,name="RdBu"))
p<-ggplot(data=data_pca,aes(x=PC1,y=PC2,label=INDIV))+
theme_minimal()+
theme(panel.grid=element_blank(),
panel.border=element_rect(fill="transparent"),
plot.title=element_text(hjust=0.5))+
geom_hline(yintercept=0,lty=2)+
geom_vline(xintercept=0,lty=2)+
geom_point(size=3,aes(col=LOCA))+
xlab(paste("PCA 1 (",round(pca$varprop[1]*100,2),"% )",sep=""))+
ylab(paste("PCA 2 (",round(pca$varprop[2]*100,2),"% )",sep=""))+
scale_colour_manual(name="Location",
values=c(color_med_atl[2],
color_med_atl[1],
color_med_atl[3],
color_med_atl[4]))
p1<-p
p<-ggplot(data=data_pca,aes(x=PC3,y=PC4,label=INDIV))+
theme_minimal()+
theme(panel.grid=element_blank(),
panel.border=element_rect(fill="transparent"),
plot.title=element_text(hjust=0.5))+
geom_hline(yintercept=0,lty=2)+
geom_vline(xintercept=0,lty=2)+
geom_point(size=3,aes(col=LOCA))+
xlab(paste("PCA 3 (",round(pca$varprop[3]*100,2),"% )",sep=""))+
ylab(paste("PCA 4 (",round(pca$varprop[4]*100,2),"% )",sep=""))+
scale_colour_manual(name="Location",
values=c(color_med_atl[2],
color_med_atl[1],
color_med_atl[3],
color_med_atl[4]))
p2<-p
data_varpop=data.frame(PC=factor(paste("P",seq(1,10),sep=""),levels=paste("P",seq(1,10),sep="")),VAR=pca$varprop[1:10])
pp<-ggplot(data_varpop,aes(x=PC,y=VAR))+
geom_bar(stat='identity',fill="dodgerblue2",alpha=0.25)+
theme_classic()+
xlab("Principal Component")+
ylab("Variation explained (%)")
```
```{r}
subplot(ggplotly(p1)%>% layout(legend = list(orientation = "h", x = 0.2, y =-0.15)), ggplotly(p2)%>%hide_legend(), ggplotly(pp)%>%hide_legend(), titleX=T,titleY=T,margin=0.035,widths=c(0.375,0.425,0.2),which_layout=1) %>% partial_bundle()
```
### maf = 0.35
```{r}
pca=PCA_list$All_unfiltered$maf0.35[[1]]
data_pca=data.frame(INDIV=pca$sample.id,
PC1=pca$eigenvect[,1],
PC2=pca$eigenvect[,2],
PC3=pca$eigenvect[,3],
PC4=pca$eigenvect[,4],
LOCA=c(rep("Algarve",5),
rep("Bay of Biscay",5),
rep("Gulf of Lion",5),
rep("Costa Calida",5)))
color_med_atl=rev(brewer.pal(n=4,name="RdBu"))
p<-ggplot(data=data_pca,aes(x=PC1,y=PC2,label=INDIV))+
theme_minimal()+
theme(panel.grid=element_blank(),
panel.border=element_rect(fill="transparent"),
plot.title=element_text(hjust=0.5))+
geom_hline(yintercept=0,lty=2)+
geom_vline(xintercept=0,lty=2)+
geom_point(size=3,aes(col=LOCA))+
xlab(paste("PCA 1 (",round(pca$varprop[1]*100,2),"% )",sep=""))+
ylab(paste("PCA 2 (",round(pca$varprop[2]*100,2),"% )",sep=""))+
scale_colour_manual(name="Location",
values=c(color_med_atl[2],
color_med_atl[1],
color_med_atl[3],
color_med_atl[4]))
p1<-p
p<-ggplot(data=data_pca,aes(x=PC3,y=PC4,label=INDIV))+
theme_minimal()+
theme(panel.grid=element_blank(),
panel.border=element_rect(fill="transparent"),
plot.title=element_text(hjust=0.5))+
geom_hline(yintercept=0,lty=2)+
geom_vline(xintercept=0,lty=2)+
geom_point(size=3,aes(col=LOCA))+
xlab(paste("PCA 3 (",round(pca$varprop[3]*100,2),"% )",sep=""))+
ylab(paste("PCA 4 (",round(pca$varprop[4]*100,2),"% )",sep=""))+
scale_colour_manual(name="Location",
values=c(color_med_atl[2],
color_med_atl[1],
color_med_atl[3],
color_med_atl[4]))
p2<-p
data_varpop=data.frame(PC=factor(paste("P",seq(1,10),sep=""),levels=paste("P",seq(1,10),sep="")),VAR=pca$varprop[1:10])
pp<-ggplot(data_varpop,aes(x=PC,y=VAR))+
geom_bar(stat='identity',fill="dodgerblue2",alpha=0.25)+
theme_classic()+
xlab("Principal Component")+
ylab("Variation explained (%)")
```
```{r}
subplot(ggplotly(p1)%>% layout(legend = list(orientation = "h", x = 0.2, y =-0.15)), ggplotly(p2)%>%hide_legend(), ggplotly(pp)%>%hide_legend(), titleX=T,titleY=T,margin=0.035,widths=c(0.375,0.425,0.2),which_layout=1) %>% partial_bundle()
```
### maf = 0.40
```{r}
pca=PCA_list$All_unfiltered$maf0.4[[1]]
data_pca=data.frame(INDIV=pca$sample.id,
PC1=pca$eigenvect[,1],
PC2=pca$eigenvect[,2],
PC3=pca$eigenvect[,3],
PC4=pca$eigenvect[,4],
LOCA=c(rep("Algarve",5),
rep("Bay of Biscay",5),
rep("Gulf of Lion",5),
rep("Costa Calida",5)))
color_med_atl=rev(brewer.pal(n=4,name="RdBu"))
p<-ggplot(data=data_pca,aes(x=PC1,y=PC2,label=INDIV))+
theme_minimal()+
theme(panel.grid=element_blank(),
panel.border=element_rect(fill="transparent"),
plot.title=element_text(hjust=0.5))+
geom_hline(yintercept=0,lty=2)+
geom_vline(xintercept=0,lty=2)+
geom_point(size=3,aes(col=LOCA))+
xlab(paste("PCA 1 (",round(pca$varprop[1]*100,2),"% )",sep=""))+
ylab(paste("PCA 2 (",round(pca$varprop[2]*100,2),"% )",sep=""))+
scale_colour_manual(name="Location",
values=c(color_med_atl[2],
color_med_atl[1],
color_med_atl[3],
color_med_atl[4]))
p1<-p
p<-ggplot(data=data_pca,aes(x=PC3,y=PC4,label=INDIV))+
theme_minimal()+
theme(panel.grid=element_blank(),
panel.border=element_rect(fill="transparent"),
plot.title=element_text(hjust=0.5))+
geom_hline(yintercept=0,lty=2)+
geom_vline(xintercept=0,lty=2)+
geom_point(size=3,aes(col=LOCA))+
xlab(paste("PCA 3 (",round(pca$varprop[3]*100,2),"% )",sep=""))+
ylab(paste("PCA 4 (",round(pca$varprop[4]*100,2),"% )",sep=""))+
scale_colour_manual(name="Location",
values=c(color_med_atl[2],
color_med_atl[1],
color_med_atl[3],
color_med_atl[4]))
p2<-p
data_varpop=data.frame(PC=factor(paste("P",seq(1,10),sep=""),levels=paste("P",seq(1,10),sep="")),VAR=pca$varprop[1:10])
pp<-ggplot(data_varpop,aes(x=PC,y=VAR))+
geom_bar(stat='identity',fill="dodgerblue2",alpha=0.25)+
theme_classic()+
xlab("Principal Component")+
ylab("Variation explained (%)")
```
```{r}
subplot(ggplotly(p1)%>% layout(legend = list(orientation = "h", x = 0.2, y =-0.15)), ggplotly(p2)%>%hide_legend(), ggplotly(pp)%>%hide_legend(), titleX=T,titleY=T,margin=0.035,widths=c(0.375,0.425,0.2),which_layout=1) %>% partial_bundle()
```
### maf = 0.45
```{r}
pca=PCA_list$All_unfiltered$maf0.45[[1]]
data_pca=data.frame(INDIV=pca$sample.id,
PC1=pca$eigenvect[,1],
PC2=pca$eigenvect[,2],
PC3=pca$eigenvect[,3],
PC4=pca$eigenvect[,4],
LOCA=c(rep("Algarve",5),
rep("Bay of Biscay",5),
rep("Gulf of Lion",5),
rep("Costa Calida",5)))
color_med_atl=rev(brewer.pal(n=4,name="RdBu"))
p<-ggplot(data=data_pca,aes(x=PC1,y=PC2,label=INDIV))+
theme_minimal()+
theme(panel.grid=element_blank(),
panel.border=element_rect(fill="transparent"),
plot.title=element_text(hjust=0.5))+
geom_hline(yintercept=0,lty=2)+
geom_vline(xintercept=0,lty=2)+
geom_point(size=3,aes(col=LOCA))+
xlab(paste("PCA 1 (",round(pca$varprop[1]*100,2),"% )",sep=""))+
ylab(paste("PCA 2 (",round(pca$varprop[2]*100,2),"% )",sep=""))+
scale_colour_manual(name="Location",
values=c(color_med_atl[2],
color_med_atl[1],
color_med_atl[3],
color_med_atl[4]))
p1<-p
p<-ggplot(data=data_pca,aes(x=PC3,y=PC4,label=INDIV))+
theme_minimal()+
theme(panel.grid=element_blank(),
panel.border=element_rect(fill="transparent"),
plot.title=element_text(hjust=0.5))+
geom_hline(yintercept=0,lty=2)+
geom_vline(xintercept=0,lty=2)+
geom_point(size=3,aes(col=LOCA))+
xlab(paste("PCA 3 (",round(pca$varprop[3]*100,2),"% )",sep=""))+
ylab(paste("PCA 4 (",round(pca$varprop[4]*100,2),"% )",sep=""))+
scale_colour_manual(name="Location",
values=c(color_med_atl[2],
color_med_atl[1],
color_med_atl[3],
color_med_atl[4]))
p2<-p
data_varpop=data.frame(PC=factor(paste("P",seq(1,10),sep=""),levels=paste("P",seq(1,10),sep="")),VAR=pca$varprop[1:10])
pp<-ggplot(data_varpop,aes(x=PC,y=VAR))+
geom_bar(stat='identity',fill="dodgerblue2",alpha=0.25)+
theme_classic()+
xlab("Principal Component")+
ylab("Variation explained (%)")
```
```{r}
subplot(ggplotly(p1)%>% layout(legend = list(orientation = "h", x = 0.2, y =-0.15)), ggplotly(p2)%>%hide_legend(), ggplotly(pp)%>%hide_legend(), titleX=T,titleY=T,margin=0.035,widths=c(0.375,0.425,0.2),which_layout=1) %>% partial_bundle()
```
### maf = 0.50
```{r}
pca=PCA_list$All_unfiltered$maf0.5[[1]]
data_pca=data.frame(INDIV=pca$sample.id,
PC1=pca$eigenvect[,1],
PC2=pca$eigenvect[,2],
PC3=pca$eigenvect[,3],
PC4=pca$eigenvect[,4],
LOCA=c(rep("Algarve",5),
rep("Bay of Biscay",5),
rep("Gulf of Lion",5),
rep("Costa Calida",5)))
color_med_atl=rev(brewer.pal(n=4,name="RdBu"))
p<-ggplot(data=data_pca,aes(x=PC1,y=PC2,label=INDIV))+
theme_minimal()+
theme(panel.grid=element_blank(),
panel.border=element_rect(fill="transparent"),
plot.title=element_text(hjust=0.5))+
geom_hline(yintercept=0,lty=2)+
geom_vline(xintercept=0,lty=2)+
geom_point(size=3,aes(col=LOCA))+
xlab(paste("PCA 1 (",round(pca$varprop[1]*100,2),"% )",sep=""))+
ylab(paste("PCA 2 (",round(pca$varprop[2]*100,2),"% )",sep=""))+
scale_colour_manual(name="Location",
values=c(color_med_atl[2],
color_med_atl[1],
color_med_atl[3],
color_med_atl[4]))
p1<-p
p<-ggplot(data=data_pca,aes(x=PC3,y=PC4,label=INDIV))+
theme_minimal()+
theme(panel.grid=element_blank(),
panel.border=element_rect(fill="transparent"),
plot.title=element_text(hjust=0.5))+
geom_hline(yintercept=0,lty=2)+
geom_vline(xintercept=0,lty=2)+
geom_point(size=3,aes(col=LOCA))+
xlab(paste("PCA 3 (",round(pca$varprop[3]*100,2),"% )",sep=""))+
ylab(paste("PCA 4 (",round(pca$varprop[4]*100,2),"% )",sep=""))+
scale_colour_manual(name="Location",
values=c(color_med_atl[2],
color_med_atl[1],
color_med_atl[3],
color_med_atl[4]))
p2<-p
data_varpop=data.frame(PC=factor(paste("P",seq(1,10),sep=""),levels=paste("P",seq(1,10),sep="")),VAR=pca$varprop[1:10])
pp<-ggplot(data_varpop,aes(x=PC,y=VAR))+
geom_bar(stat='identity',fill="dodgerblue2",alpha=0.25)+
theme_classic()+
xlab("Principal Component")+
ylab("Variation explained (%)")
```
```{r}
subplot(ggplotly(p1)%>% layout(legend = list(orientation = "h", x = 0.2, y =-0.15)), ggplotly(p2)%>%hide_legend(), ggplotly(pp)%>%hide_legend(), titleX=T,titleY=T,margin=0.035,widths=c(0.375,0.425,0.2),which_layout=1) %>% partial_bundle()
```
Row {.tabset data-height=50}
-----------------------
<center>
<font size="6">**Pruned unfiltered SNPS**</font>
</center>
Row {.tabset data-height=600}
-----------------------
### maf = 0
```{r}
pca=PCA_list$Prune_unfiltered$maf0[[1]]
data_pca=data.frame(INDIV=pca$sample.id,
PC1=pca$eigenvect[,1],
PC2=pca$eigenvect[,2],
PC3=pca$eigenvect[,3],
PC4=pca$eigenvect[,4],
LOCA=c(rep("Algarve",5),
rep("Bay of Biscay",5),
rep("Gulf of Lion",5),
rep("Costa Calida",5)))
color_med_atl=rev(brewer.pal(n=4,name="RdBu"))
p<-ggplot(data=data_pca,aes(x=PC1,y=PC2,label=INDIV))+
theme_minimal()+
theme(panel.grid=element_blank(),
panel.border=element_rect(fill="transparent"),
plot.title=element_text(hjust=0.5))+
geom_hline(yintercept=0,lty=2)+
geom_vline(xintercept=0,lty=2)+
geom_point(size=3,aes(col=LOCA))+
xlab(paste("PCA 1 (",round(pca$varprop[1]*100,2),"% )",sep=""))+
ylab(paste("PCA 2 (",round(pca$varprop[2]*100,2),"% )",sep=""))+
scale_colour_manual(name="Location",
values=c(color_med_atl[2],
color_med_atl[1],
color_med_atl[3],
color_med_atl[4]))
p1<-p
p<-ggplot(data=data_pca,aes(x=PC3,y=PC4,label=INDIV))+
theme_minimal()+
theme(panel.grid=element_blank(),
panel.border=element_rect(fill="transparent"),
plot.title=element_text(hjust=0.5))+
geom_hline(yintercept=0,lty=2)+
geom_vline(xintercept=0,lty=2)+
geom_point(size=3,aes(col=LOCA))+
xlab(paste("PCA 3 (",round(pca$varprop[3]*100,2),"% )",sep=""))+
ylab(paste("PCA 4 (",round(pca$varprop[4]*100,2),"% )",sep=""))+
scale_colour_manual(name="Location",
values=c(color_med_atl[2],
color_med_atl[1],
color_med_atl[3],
color_med_atl[4]))
p2<-p
data_varpop=data.frame(PC=factor(paste("P",seq(1,10),sep=""),levels=paste("P",seq(1,10),sep="")),VAR=pca$varprop[1:10])
pp<-ggplot(data_varpop,aes(x=PC,y=VAR))+
geom_bar(stat='identity',fill="dodgerblue2",alpha=0.25)+
theme_classic()+
xlab("Principal Component")+
ylab("Variation explained (%)")
```
```{r}
subplot(ggplotly(p1)%>% layout(legend = list(orientation = "h", x = 0.2, y =-0.15)), ggplotly(p2)%>%hide_legend(), ggplotly(pp)%>%hide_legend(), titleX=T,titleY=T,margin=0.035,widths=c(0.375,0.425,0.2),which_layout=1) %>% partial_bundle()
```
### maf = 0.05
```{r}
pca=PCA_list$Prune_unfiltered$maf0.05[[1]]
data_pca=data.frame(INDIV=pca$sample.id,
PC1=pca$eigenvect[,1],
PC2=pca$eigenvect[,2],
PC3=pca$eigenvect[,3],
PC4=pca$eigenvect[,4],
LOCA=c(rep("Algarve",5),
rep("Bay of Biscay",5),
rep("Gulf of Lion",5),
rep("Costa Calida",5)))
color_med_atl=rev(brewer.pal(n=4,name="RdBu"))
p<-ggplot(data=data_pca,aes(x=PC1,y=PC2,label=INDIV))+
theme_minimal()+
theme(panel.grid=element_blank(),
panel.border=element_rect(fill="transparent"),
plot.title=element_text(hjust=0.5))+
geom_hline(yintercept=0,lty=2)+
geom_vline(xintercept=0,lty=2)+
geom_point(size=3,aes(col=LOCA))+
xlab(paste("PCA 1 (",round(pca$varprop[1]*100,2),"% )",sep=""))+
ylab(paste("PCA 2 (",round(pca$varprop[2]*100,2),"% )",sep=""))+
scale_colour_manual(name="Location",
values=c(color_med_atl[2],
color_med_atl[1],
color_med_atl[3],
color_med_atl[4]))
p1<-p
p<-ggplot(data=data_pca,aes(x=PC3,y=PC4,label=INDIV))+
theme_minimal()+
theme(panel.grid=element_blank(),
panel.border=element_rect(fill="transparent"),
plot.title=element_text(hjust=0.5))+
geom_hline(yintercept=0,lty=2)+
geom_vline(xintercept=0,lty=2)+
geom_point(size=3,aes(col=LOCA))+
xlab(paste("PCA 3 (",round(pca$varprop[3]*100,2),"% )",sep=""))+
ylab(paste("PCA 4 (",round(pca$varprop[4]*100,2),"% )",sep=""))+
scale_colour_manual(name="Location",
values=c(color_med_atl[2],
color_med_atl[1],
color_med_atl[3],
color_med_atl[4]))
p2<-p
data_varpop=data.frame(PC=factor(paste("P",seq(1,10),sep=""),levels=paste("P",seq(1,10),sep="")),VAR=pca$varprop[1:10])
pp<-ggplot(data_varpop,aes(x=PC,y=VAR))+
geom_bar(stat='identity',fill="dodgerblue2",alpha=0.25)+
theme_classic()+
xlab("Principal Component")+
ylab("Variation explained (%)")
```
```{r}
subplot(ggplotly(p1)%>% layout(legend = list(orientation = "h", x = 0.2, y =-0.15)), ggplotly(p2)%>%hide_legend(), ggplotly(pp)%>%hide_legend(), titleX=T,titleY=T,margin=0.035,widths=c(0.375,0.425,0.2),which_layout=1) %>% partial_bundle()
```
### maf = 0.1
```{r}
pca=PCA_list$Prune_unfiltered$maf0.1[[1]]
data_pca=data.frame(INDIV=pca$sample.id,
PC1=pca$eigenvect[,1],
PC2=pca$eigenvect[,2],
PC3=pca$eigenvect[,3],
PC4=pca$eigenvect[,4],
LOCA=c(rep("Algarve",5),
rep("Bay of Biscay",5),
rep("Gulf of Lion",5),
rep("Costa Calida",5)))
color_med_atl=rev(brewer.pal(n=4,name="RdBu"))
p<-ggplot(data=data_pca,aes(x=PC1,y=PC2,label=INDIV))+
theme_minimal()+
theme(panel.grid=element_blank(),
panel.border=element_rect(fill="transparent"),
plot.title=element_text(hjust=0.5))+
geom_hline(yintercept=0,lty=2)+
geom_vline(xintercept=0,lty=2)+
geom_point(size=3,aes(col=LOCA))+
xlab(paste("PCA 1 (",round(pca$varprop[1]*100,2),"% )",sep=""))+
ylab(paste("PCA 2 (",round(pca$varprop[2]*100,2),"% )",sep=""))+
scale_colour_manual(name="Location",
values=c(color_med_atl[2],
color_med_atl[1],
color_med_atl[3],
color_med_atl[4]))
p1<-p
p<-ggplot(data=data_pca,aes(x=PC3,y=PC4,label=INDIV))+
theme_minimal()+
theme(panel.grid=element_blank(),
panel.border=element_rect(fill="transparent"),
plot.title=element_text(hjust=0.5))+
geom_hline(yintercept=0,lty=2)+
geom_vline(xintercept=0,lty=2)+
geom_point(size=3,aes(col=LOCA))+
xlab(paste("PCA 3 (",round(pca$varprop[3]*100,2),"% )",sep=""))+
ylab(paste("PCA 4 (",round(pca$varprop[4]*100,2),"% )",sep=""))+
scale_colour_manual(name="Location",
values=c(color_med_atl[2],
color_med_atl[1],
color_med_atl[3],
color_med_atl[4]))
p2<-p
data_varpop=data.frame(PC=factor(paste("P",seq(1,10),sep=""),levels=paste("P",seq(1,10),sep="")),VAR=pca$varprop[1:10])
pp<-ggplot(data_varpop,aes(x=PC,y=VAR))+
geom_bar(stat='identity',fill="dodgerblue2",alpha=0.25)+
theme_classic()+
xlab("Principal Component")+
ylab("Variation explained (%)")
```
```{r}
subplot(ggplotly(p1)%>% layout(legend = list(orientation = "h", x = 0.2, y =-0.15)), ggplotly(p2)%>%hide_legend(), ggplotly(pp)%>%hide_legend(), titleX=T,titleY=T,margin=0.035,widths=c(0.375,0.425,0.2),which_layout=1) %>% partial_bundle()
```
### maf = 0.15
```{r}
pca=PCA_list$Prune_unfiltered$maf0.15[[1]]
data_pca=data.frame(INDIV=pca$sample.id,
PC1=pca$eigenvect[,1],
PC2=pca$eigenvect[,2],
PC3=pca$eigenvect[,3],
PC4=pca$eigenvect[,4],
LOCA=c(rep("Algarve",5),
rep("Bay of Biscay",5),
rep("Gulf of Lion",5),
rep("Costa Calida",5)))
color_med_atl=rev(brewer.pal(n=4,name="RdBu"))
p<-ggplot(data=data_pca,aes(x=PC1,y=PC2,label=INDIV))+
theme_minimal()+
theme(panel.grid=element_blank(),
panel.border=element_rect(fill="transparent"),
plot.title=element_text(hjust=0.5))+
geom_hline(yintercept=0,lty=2)+
geom_vline(xintercept=0,lty=2)+
geom_point(size=3,aes(col=LOCA))+
xlab(paste("PCA 1 (",round(pca$varprop[1]*100,2),"% )",sep=""))+
ylab(paste("PCA 2 (",round(pca$varprop[2]*100,2),"% )",sep=""))+
scale_colour_manual(name="Location",
values=c(color_med_atl[2],
color_med_atl[1],
color_med_atl[3],
color_med_atl[4]))
p1<-p
p<-ggplot(data=data_pca,aes(x=PC3,y=PC4,label=INDIV))+
theme_minimal()+
theme(panel.grid=element_blank(),
panel.border=element_rect(fill="transparent"),
plot.title=element_text(hjust=0.5))+
geom_hline(yintercept=0,lty=2)+
geom_vline(xintercept=0,lty=2)+
geom_point(size=3,aes(col=LOCA))+
xlab(paste("PCA 3 (",round(pca$varprop[3]*100,2),"% )",sep=""))+
ylab(paste("PCA 4 (",round(pca$varprop[4]*100,2),"% )",sep=""))+
scale_colour_manual(name="Location",
values=c(color_med_atl[2],
color_med_atl[1],
color_med_atl[3],
color_med_atl[4]))
p2<-p
data_varpop=data.frame(PC=factor(paste("P",seq(1,10),sep=""),levels=paste("P",seq(1,10),sep="")),VAR=pca$varprop[1:10])
pp<-ggplot(data_varpop,aes(x=PC,y=VAR))+
geom_bar(stat='identity',fill="dodgerblue2",alpha=0.25)+
theme_classic()+
xlab("Principal Component")+
ylab("Variation explained (%)")
```
```{r}
subplot(ggplotly(p1)%>% layout(legend = list(orientation = "h", x = 0.2, y =-0.15)), ggplotly(p2)%>%hide_legend(), ggplotly(pp)%>%hide_legend(), titleX=T,titleY=T,margin=0.035,widths=c(0.375,0.425,0.2),which_layout=1) %>% partial_bundle()
```
### maf = 0.20
```{r}
pca=PCA_list$Prune_unfiltered$maf0.2[[1]]
data_pca=data.frame(INDIV=pca$sample.id,
PC1=pca$eigenvect[,1],
PC2=pca$eigenvect[,2],
PC3=pca$eigenvect[,3],
PC4=pca$eigenvect[,4],
LOCA=c(rep("Algarve",5),
rep("Bay of Biscay",5),
rep("Gulf of Lion",5),
rep("Costa Calida",5)))
color_med_atl=rev(brewer.pal(n=4,name="RdBu"))
p<-ggplot(data=data_pca,aes(x=PC1,y=PC2,label=INDIV))+
theme_minimal()+
theme(panel.grid=element_blank(),
panel.border=element_rect(fill="transparent"),
plot.title=element_text(hjust=0.5))+
geom_hline(yintercept=0,lty=2)+
geom_vline(xintercept=0,lty=2)+
geom_point(size=3,aes(col=LOCA))+
xlab(paste("PCA 1 (",round(pca$varprop[1]*100,2),"% )",sep=""))+
ylab(paste("PCA 2 (",round(pca$varprop[2]*100,2),"% )",sep=""))+
scale_colour_manual(name="Location",
values=c(color_med_atl[2],
color_med_atl[1],
color_med_atl[3],
color_med_atl[4]))
p1<-p
p<-ggplot(data=data_pca,aes(x=PC3,y=PC4,label=INDIV))+
theme_minimal()+
theme(panel.grid=element_blank(),
panel.border=element_rect(fill="transparent"),
plot.title=element_text(hjust=0.5))+
geom_hline(yintercept=0,lty=2)+
geom_vline(xintercept=0,lty=2)+
geom_point(size=3,aes(col=LOCA))+
xlab(paste("PCA 3 (",round(pca$varprop[3]*100,2),"% )",sep=""))+
ylab(paste("PCA 4 (",round(pca$varprop[4]*100,2),"% )",sep=""))+
scale_colour_manual(name="Location",
values=c(color_med_atl[2],
color_med_atl[1],
color_med_atl[3],
color_med_atl[4]))
p2<-p
data_varpop=data.frame(PC=factor(paste("P",seq(1,10),sep=""),levels=paste("P",seq(1,10),sep="")),VAR=pca$varprop[1:10])
pp<-ggplot(data_varpop,aes(x=PC,y=VAR))+
geom_bar(stat='identity',fill="dodgerblue2",alpha=0.25)+
theme_classic()+
xlab("Principal Component")+
ylab("Variation explained (%)")
```
```{r}
subplot(ggplotly(p1)%>% layout(legend = list(orientation = "h", x = 0.2, y =-0.15)), ggplotly(p2)%>%hide_legend(), ggplotly(pp)%>%hide_legend(), titleX=T,titleY=T,margin=0.035,widths=c(0.375,0.425,0.2),which_layout=1) %>% partial_bundle()
```
### maf = 0.25
```{r}
pca=PCA_list$Prune_unfiltered$maf0.25[[1]]
data_pca=data.frame(INDIV=pca$sample.id,
PC1=pca$eigenvect[,1],
PC2=pca$eigenvect[,2],
PC3=pca$eigenvect[,3],
PC4=pca$eigenvect[,4],
LOCA=c(rep("Algarve",5),
rep("Bay of Biscay",5),
rep("Gulf of Lion",5),
rep("Costa Calida",5)))
color_med_atl=rev(brewer.pal(n=4,name="RdBu"))
p<-ggplot(data=data_pca,aes(x=PC1,y=PC2,label=INDIV))+
theme_minimal()+
theme(panel.grid=element_blank(),
panel.border=element_rect(fill="transparent"),
plot.title=element_text(hjust=0.5))+
geom_hline(yintercept=0,lty=2)+
geom_vline(xintercept=0,lty=2)+
geom_point(size=3,aes(col=LOCA))+
xlab(paste("PCA 1 (",round(pca$varprop[1]*100,2),"% )",sep=""))+
ylab(paste("PCA 2 (",round(pca$varprop[2]*100,2),"% )",sep=""))+
scale_colour_manual(name="Location",
values=c(color_med_atl[2],
color_med_atl[1],
color_med_atl[3],
color_med_atl[4]))
p1<-p
p<-ggplot(data=data_pca,aes(x=PC3,y=PC4,label=INDIV))+
theme_minimal()+
theme(panel.grid=element_blank(),
panel.border=element_rect(fill="transparent"),
plot.title=element_text(hjust=0.5))+
geom_hline(yintercept=0,lty=2)+
geom_vline(xintercept=0,lty=2)+
geom_point(size=3,aes(col=LOCA))+
xlab(paste("PCA 3 (",round(pca$varprop[3]*100,2),"% )",sep=""))+
ylab(paste("PCA 4 (",round(pca$varprop[4]*100,2),"% )",sep=""))+
scale_colour_manual(name="Location",
values=c(color_med_atl[2],
color_med_atl[1],
color_med_atl[3],
color_med_atl[4]))
p2<-p
data_varpop=data.frame(PC=factor(paste("P",seq(1,10),sep=""),levels=paste("P",seq(1,10),sep="")),VAR=pca$varprop[1:10])
pp<-ggplot(data_varpop,aes(x=PC,y=VAR))+
geom_bar(stat='identity',fill="dodgerblue2",alpha=0.25)+
theme_classic()+
xlab("Principal Component")+
ylab("Variation explained (%)")
```
```{r}
subplot(ggplotly(p1)%>% layout(legend = list(orientation = "h", x = 0.2, y =-0.15)), ggplotly(p2)%>%hide_legend(), ggplotly(pp)%>%hide_legend(), titleX=T,titleY=T,margin=0.035,widths=c(0.375,0.425,0.2),which_layout=1) %>% partial_bundle()
```
### maf = 0.30
```{r}
pca=PCA_list$Prune_unfiltered$maf0.3[[1]]
data_pca=data.frame(INDIV=pca$sample.id,
PC1=pca$eigenvect[,1],
PC2=pca$eigenvect[,2],
PC3=pca$eigenvect[,3],
PC4=pca$eigenvect[,4],
LOCA=c(rep("Algarve",5),
rep("Bay of Biscay",5),
rep("Gulf of Lion",5),
rep("Costa Calida",5)))
color_med_atl=rev(brewer.pal(n=4,name="RdBu"))
p<-ggplot(data=data_pca,aes(x=PC1,y=PC2,label=INDIV))+
theme_minimal()+
theme(panel.grid=element_blank(),
panel.border=element_rect(fill="transparent"),
plot.title=element_text(hjust=0.5))+
geom_hline(yintercept=0,lty=2)+
geom_vline(xintercept=0,lty=2)+
geom_point(size=3,aes(col=LOCA))+
xlab(paste("PCA 1 (",round(pca$varprop[1]*100,2),"% )",sep=""))+
ylab(paste("PCA 2 (",round(pca$varprop[2]*100,2),"% )",sep=""))+
scale_colour_manual(name="Location",
values=c(color_med_atl[2],
color_med_atl[1],
color_med_atl[3],
color_med_atl[4]))
p1<-p
p<-ggplot(data=data_pca,aes(x=PC3,y=PC4,label=INDIV))+
theme_minimal()+
theme(panel.grid=element_blank(),
panel.border=element_rect(fill="transparent"),
plot.title=element_text(hjust=0.5))+
geom_hline(yintercept=0,lty=2)+
geom_vline(xintercept=0,lty=2)+
geom_point(size=3,aes(col=LOCA))+
xlab(paste("PCA 3 (",round(pca$varprop[3]*100,2),"% )",sep=""))+
ylab(paste("PCA 4 (",round(pca$varprop[4]*100,2),"% )",sep=""))+
scale_colour_manual(name="Location",
values=c(color_med_atl[2],
color_med_atl[1],
color_med_atl[3],
color_med_atl[4]))
p2<-p
data_varpop=data.frame(PC=factor(paste("P",seq(1,10),sep=""),levels=paste("P",seq(1,10),sep="")),VAR=pca$varprop[1:10])
pp<-ggplot(data_varpop,aes(x=PC,y=VAR))+
geom_bar(stat='identity',fill="dodgerblue2",alpha=0.25)+
theme_classic()+
xlab("Principal Component")+
ylab("Variation explained (%)")
```
```{r}
subplot(ggplotly(p1)%>% layout(legend = list(orientation = "h", x = 0.2, y =-0.15)), ggplotly(p2)%>%hide_legend(), ggplotly(pp)%>%hide_legend(), titleX=T,titleY=T,margin=0.035,widths=c(0.375,0.425,0.2),which_layout=1) %>% partial_bundle()
```
### maf = 0.35
```{r}
pca=PCA_list$Prune_unfiltered$maf0.35[[1]]
data_pca=data.frame(INDIV=pca$sample.id,
PC1=pca$eigenvect[,1],
PC2=pca$eigenvect[,2],
PC3=pca$eigenvect[,3],
PC4=pca$eigenvect[,4],
LOCA=c(rep("Algarve",5),
rep("Bay of Biscay",5),
rep("Gulf of Lion",5),
rep("Costa Calida",5)))
color_med_atl=rev(brewer.pal(n=4,name="RdBu"))
p<-ggplot(data=data_pca,aes(x=PC1,y=PC2,label=INDIV))+
theme_minimal()+
theme(panel.grid=element_blank(),
panel.border=element_rect(fill="transparent"),
plot.title=element_text(hjust=0.5))+
geom_hline(yintercept=0,lty=2)+
geom_vline(xintercept=0,lty=2)+
geom_point(size=3,aes(col=LOCA))+
xlab(paste("PCA 1 (",round(pca$varprop[1]*100,2),"% )",sep=""))+
ylab(paste("PCA 2 (",round(pca$varprop[2]*100,2),"% )",sep=""))+
scale_colour_manual(name="Location",
values=c(color_med_atl[2],
color_med_atl[1],
color_med_atl[3],
color_med_atl[4]))
p1<-p
p<-ggplot(data=data_pca,aes(x=PC3,y=PC4,label=INDIV))+
theme_minimal()+
theme(panel.grid=element_blank(),
panel.border=element_rect(fill="transparent"),
plot.title=element_text(hjust=0.5))+
geom_hline(yintercept=0,lty=2)+
geom_vline(xintercept=0,lty=2)+
geom_point(size=3,aes(col=LOCA))+
xlab(paste("PCA 3 (",round(pca$varprop[3]*100,2),"% )",sep=""))+
ylab(paste("PCA 4 (",round(pca$varprop[4]*100,2),"% )",sep=""))+
scale_colour_manual(name="Location",
values=c(color_med_atl[2],
color_med_atl[1],
color_med_atl[3],
color_med_atl[4]))
p2<-p
data_varpop=data.frame(PC=factor(paste("P",seq(1,10),sep=""),levels=paste("P",seq(1,10),sep="")),VAR=pca$varprop[1:10])
pp<-ggplot(data_varpop,aes(x=PC,y=VAR))+
geom_bar(stat='identity',fill="dodgerblue2",alpha=0.25)+
theme_classic()+
xlab("Principal Component")+
ylab("Variation explained (%)")
```
```{r}
subplot(ggplotly(p1)%>% layout(legend = list(orientation = "h", x = 0.2, y =-0.15)), ggplotly(p2)%>%hide_legend(), ggplotly(pp)%>%hide_legend(), titleX=T,titleY=T,margin=0.035,widths=c(0.375,0.425,0.2),which_layout=1) %>% partial_bundle()
```
### maf = 0.40
```{r}
pca=PCA_list$Prune_unfiltered$maf0.4[[1]]
data_pca=data.frame(INDIV=pca$sample.id,
PC1=pca$eigenvect[,1],
PC2=pca$eigenvect[,2],
PC3=pca$eigenvect[,3],
PC4=pca$eigenvect[,4],
LOCA=c(rep("Algarve",5),
rep("Bay of Biscay",5),
rep("Gulf of Lion",5),
rep("Costa Calida",5)))
color_med_atl=rev(brewer.pal(n=4,name="RdBu"))
p<-ggplot(data=data_pca,aes(x=PC1,y=PC2,label=INDIV))+
theme_minimal()+
theme(panel.grid=element_blank(),
panel.border=element_rect(fill="transparent"),
plot.title=element_text(hjust=0.5))+
geom_hline(yintercept=0,lty=2)+
geom_vline(xintercept=0,lty=2)+
geom_point(size=3,aes(col=LOCA))+
xlab(paste("PCA 1 (",round(pca$varprop[1]*100,2),"% )",sep=""))+
ylab(paste("PCA 2 (",round(pca$varprop[2]*100,2),"% )",sep=""))+
scale_colour_manual(name="Location",
values=c(color_med_atl[2],
color_med_atl[1],
color_med_atl[3],
color_med_atl[4]))
p1<-p
p<-ggplot(data=data_pca,aes(x=PC3,y=PC4,label=INDIV))+
theme_minimal()+
theme(panel.grid=element_blank(),
panel.border=element_rect(fill="transparent"),
plot.title=element_text(hjust=0.5))+
geom_hline(yintercept=0,lty=2)+
geom_vline(xintercept=0,lty=2)+
geom_point(size=3,aes(col=LOCA))+
xlab(paste("PCA 3 (",round(pca$varprop[3]*100,2),"% )",sep=""))+
ylab(paste("PCA 4 (",round(pca$varprop[4]*100,2),"% )",sep=""))+
scale_colour_manual(name="Location",
values=c(color_med_atl[2],
color_med_atl[1],
color_med_atl[3],
color_med_atl[4]))
p2<-p
data_varpop=data.frame(PC=factor(paste("P",seq(1,10),sep=""),levels=paste("P",seq(1,10),sep="")),VAR=pca$varprop[1:10])
pp<-ggplot(data_varpop,aes(x=PC,y=VAR))+
geom_bar(stat='identity',fill="dodgerblue2",alpha=0.25)+
theme_classic()+
xlab("Principal Component")+
ylab("Variation explained (%)")
```
```{r}
subplot(ggplotly(p1)%>% layout(legend = list(orientation = "h", x = 0.2, y =-0.15)), ggplotly(p2)%>%hide_legend(), ggplotly(pp)%>%hide_legend(), titleX=T,titleY=T,margin=0.035,widths=c(0.375,0.425,0.2),which_layout=1) %>% partial_bundle()
```
### maf = 0.45
```{r}
pca=PCA_list$Prune_unfiltered$maf0.45[[1]]
data_pca=data.frame(INDIV=pca$sample.id,
PC1=pca$eigenvect[,1],
PC2=pca$eigenvect[,2],
PC3=pca$eigenvect[,3],
PC4=pca$eigenvect[,4],
LOCA=c(rep("Algarve",5),
rep("Bay of Biscay",5),
rep("Gulf of Lion",5),
rep("Costa Calida",5)))
color_med_atl=rev(brewer.pal(n=4,name="RdBu"))
p<-ggplot(data=data_pca,aes(x=PC1,y=PC2,label=INDIV))+
theme_minimal()+
theme(panel.grid=element_blank(),
panel.border=element_rect(fill="transparent"),
plot.title=element_text(hjust=0.5))+
geom_hline(yintercept=0,lty=2)+
geom_vline(xintercept=0,lty=2)+
geom_point(size=3,aes(col=LOCA))+
xlab(paste("PCA 1 (",round(pca$varprop[1]*100,2),"% )",sep=""))+
ylab(paste("PCA 2 (",round(pca$varprop[2]*100,2),"% )",sep=""))+
scale_colour_manual(name="Location",
values=c(color_med_atl[2],
color_med_atl[1],
color_med_atl[3],
color_med_atl[4]))
p1<-p
p<-ggplot(data=data_pca,aes(x=PC3,y=PC4,label=INDIV))+
theme_minimal()+
theme(panel.grid=element_blank(),
panel.border=element_rect(fill="transparent"),
plot.title=element_text(hjust=0.5))+
geom_hline(yintercept=0,lty=2)+
geom_vline(xintercept=0,lty=2)+
geom_point(size=3,aes(col=LOCA))+
xlab(paste("PCA 3 (",round(pca$varprop[3]*100,2),"% )",sep=""))+
ylab(paste("PCA 4 (",round(pca$varprop[4]*100,2),"% )",sep=""))+
scale_colour_manual(name="Location",
values=c(color_med_atl[2],
color_med_atl[1],
color_med_atl[3],
color_med_atl[4]))
p2<-p
data_varpop=data.frame(PC=factor(paste("P",seq(1,10),sep=""),levels=paste("P",seq(1,10),sep="")),VAR=pca$varprop[1:10])
pp<-ggplot(data_varpop,aes(x=PC,y=VAR))+
geom_bar(stat='identity',fill="dodgerblue2",alpha=0.25)+
theme_classic()+
xlab("Principal Component")+
ylab("Variation explained (%)")
```
```{r}
subplot(ggplotly(p1)%>% layout(legend = list(orientation = "h", x = 0.2, y =-0.15)), ggplotly(p2)%>%hide_legend(), ggplotly(pp)%>%hide_legend(), titleX=T,titleY=T,margin=0.035,widths=c(0.375,0.425,0.2),which_layout=1) %>% partial_bundle()
```
### maf = 0.50
```{r}
pca=PCA_list$Prune_unfiltered$maf0.5[[1]]
data_pca=data.frame(INDIV=pca$sample.id,
PC1=pca$eigenvect[,1],
PC2=pca$eigenvect[,2],
PC3=pca$eigenvect[,3],
PC4=pca$eigenvect[,4],
LOCA=c(rep("Algarve",5),
rep("Bay of Biscay",5),
rep("Gulf of Lion",5),
rep("Costa Calida",5)))
color_med_atl=rev(brewer.pal(n=4,name="RdBu"))
p<-ggplot(data=data_pca,aes(x=PC1,y=PC2,label=INDIV))+
theme_minimal()+
theme(panel.grid=element_blank(),
panel.border=element_rect(fill="transparent"),
plot.title=element_text(hjust=0.5))+
geom_hline(yintercept=0,lty=2)+
geom_vline(xintercept=0,lty=2)+
geom_point(size=3,aes(col=LOCA))+
xlab(paste("PCA 1 (",round(pca$varprop[1]*100,2),"% )",sep=""))+
ylab(paste("PCA 2 (",round(pca$varprop[2]*100,2),"% )",sep=""))+
scale_colour_manual(name="Location",
values=c(color_med_atl[2],
color_med_atl[1],
color_med_atl[3],
color_med_atl[4]))
p1<-p
p<-ggplot(data=data_pca,aes(x=PC3,y=PC4,label=INDIV))+
theme_minimal()+
theme(panel.grid=element_blank(),
panel.border=element_rect(fill="transparent"),
plot.title=element_text(hjust=0.5))+
geom_hline(yintercept=0,lty=2)+
geom_vline(xintercept=0,lty=2)+
geom_point(size=3,aes(col=LOCA))+
xlab(paste("PCA 3 (",round(pca$varprop[3]*100,2),"% )",sep=""))+
ylab(paste("PCA 4 (",round(pca$varprop[4]*100,2),"% )",sep=""))+
scale_colour_manual(name="Location",
values=c(color_med_atl[2],
color_med_atl[1],
color_med_atl[3],
color_med_atl[4]))
p2<-p
data_varpop=data.frame(PC=factor(paste("P",seq(1,10),sep=""),levels=paste("P",seq(1,10),sep="")),VAR=pca$varprop[1:10])
pp<-ggplot(data_varpop,aes(x=PC,y=VAR))+
geom_bar(stat='identity',fill="dodgerblue2",alpha=0.25)+
theme_classic()+
xlab("Principal Component")+
ylab("Variation explained (%)")
```
```{r}
subplot(ggplotly(p1)%>% layout(legend = list(orientation = "h", x = 0.2, y =-0.15)), ggplotly(p2)%>%hide_legend(), ggplotly(pp)%>%hide_legend(), titleX=T,titleY=T,margin=0.035,widths=c(0.375,0.425,0.2),which_layout=1) %>% partial_bundle()
```
Spondyliosoma cantharus {data-navmenu="Species"}
=======================================================================
```{r, include = FALSE}
load(file = paste(path,"/output/pca/Scant_PCA_list.Rdata",sep=""))
```
Row {.tabset data-height=100}
-----------------------
<center>
<font size="6">**Spondyliosoma cantharus**</font>
</center>
Row {.tabset data-height=50}
-----------------------
<center>
<font size="6">**All filtered SNPS**</font>
</center>
Row {.tabset data-height=600}
-----------------------
### maf = 0
```{r}
pca=PCA_list$All_filtered$maf0[[1]]
data_pca=data.frame(INDIV=pca$sample.id,
PC1=pca$eigenvect[,1],
PC2=pca$eigenvect[,2],
PC3=pca$eigenvect[,3],
PC4=pca$eigenvect[,4],
LOCA=c(rep("Algarve",5),
rep("Bay of Biscay",5),
rep("Gulf of Lion",5),
rep("Costa Calida",5)))
color_med_atl=rev(brewer.pal(n=4,name="RdBu"))
p<-ggplot(data=data_pca,aes(x=PC1,y=PC2,label=INDIV))+
theme_minimal()+
theme(panel.grid=element_blank(),
panel.border=element_rect(fill="transparent"),
plot.title=element_text(hjust=0.5))+
geom_hline(yintercept=0,lty=2)+
geom_vline(xintercept=0,lty=2)+
geom_point(size=3,aes(col=LOCA))+
xlab(paste("PCA 1 (",round(pca$varprop[1]*100,2),"% )",sep=""))+
ylab(paste("PCA 2 (",round(pca$varprop[2]*100,2),"% )",sep=""))+
scale_colour_manual(name="Location",
values=c(color_med_atl[2],
color_med_atl[1],
color_med_atl[3],
color_med_atl[4]))
p1<-p
p<-ggplot(data=data_pca,aes(x=PC3,y=PC4,label=INDIV))+
theme_minimal()+
theme(panel.grid=element_blank(),
panel.border=element_rect(fill="transparent"),
plot.title=element_text(hjust=0.5))+
geom_hline(yintercept=0,lty=2)+
geom_vline(xintercept=0,lty=2)+
geom_point(size=3,aes(col=LOCA))+
xlab(paste("PCA 3 (",round(pca$varprop[3]*100,2),"% )",sep=""))+
ylab(paste("PCA 4 (",round(pca$varprop[4]*100,2),"% )",sep=""))+
scale_colour_manual(name="Location",
values=c(color_med_atl[2],
color_med_atl[1],
color_med_atl[3],
color_med_atl[4]))
p2<-p
data_varpop=data.frame(PC=factor(paste("P",seq(1,10),sep=""),levels=paste("P",seq(1,10),sep="")),VAR=pca$varprop[1:10])
pp<-ggplot(data_varpop,aes(x=PC,y=VAR))+
geom_bar(stat='identity',fill="dodgerblue2",alpha=0.25)+
theme_classic()+
xlab("Principal Component")+
ylab("Variation explained (%)")
```
```{r}
subplot(ggplotly(p1)%>% layout(legend = list(orientation = "h", x = 0.2, y =-0.15)), ggplotly(p2)%>%hide_legend(), ggplotly(pp)%>%hide_legend(), titleX=T,titleY=T,margin=0.035,widths=c(0.375,0.425,0.2),which_layout=1) %>% partial_bundle()
```
### maf = 0.05
```{r}
pca=PCA_list$All_filtered$maf0.05[[1]]
data_pca=data.frame(INDIV=pca$sample.id,
PC1=pca$eigenvect[,1],
PC2=pca$eigenvect[,2],
PC3=pca$eigenvect[,3],
PC4=pca$eigenvect[,4],
LOCA=c(rep("Algarve",5),
rep("Bay of Biscay",5),
rep("Gulf of Lion",5),
rep("Costa Calida",5)))
color_med_atl=rev(brewer.pal(n=4,name="RdBu"))
p<-ggplot(data=data_pca,aes(x=PC1,y=PC2,label=INDIV))+
theme_minimal()+
theme(panel.grid=element_blank(),
panel.border=element_rect(fill="transparent"),
plot.title=element_text(hjust=0.5))+
geom_hline(yintercept=0,lty=2)+
geom_vline(xintercept=0,lty=2)+
geom_point(size=3,aes(col=LOCA))+
xlab(paste("PCA 1 (",round(pca$varprop[1]*100,2),"% )",sep=""))+
ylab(paste("PCA 2 (",round(pca$varprop[2]*100,2),"% )",sep=""))+
scale_colour_manual(name="Location",
values=c(color_med_atl[2],
color_med_atl[1],
color_med_atl[3],
color_med_atl[4]))
p1<-p
p<-ggplot(data=data_pca,aes(x=PC3,y=PC4,label=INDIV))+
theme_minimal()+
theme(panel.grid=element_blank(),
panel.border=element_rect(fill="transparent"),
plot.title=element_text(hjust=0.5))+
geom_hline(yintercept=0,lty=2)+
geom_vline(xintercept=0,lty=2)+
geom_point(size=3,aes(col=LOCA))+
xlab(paste("PCA 3 (",round(pca$varprop[3]*100,2),"% )",sep=""))+
ylab(paste("PCA 4 (",round(pca$varprop[4]*100,2),"% )",sep=""))+
scale_colour_manual(name="Location",
values=c(color_med_atl[2],
color_med_atl[1],
color_med_atl[3],
color_med_atl[4]))
p2<-p
data_varpop=data.frame(PC=factor(paste("P",seq(1,10),sep=""),levels=paste("P",seq(1,10),sep="")),VAR=pca$varprop[1:10])
pp<-ggplot(data_varpop,aes(x=PC,y=VAR))+
geom_bar(stat='identity',fill="dodgerblue2",alpha=0.25)+
theme_classic()+
xlab("Principal Component")+
ylab("Variation explained (%)")
```
```{r}
subplot(ggplotly(p1)%>% layout(legend = list(orientation = "h", x = 0.2, y =-0.15)), ggplotly(p2)%>%hide_legend(), ggplotly(pp)%>%hide_legend(), titleX=T,titleY=T,margin=0.035,widths=c(0.375,0.425,0.2),which_layout=1) %>% partial_bundle()
```
### maf = 0.1
```{r}
pca=PCA_list$All_filtered$maf0.1[[1]]
data_pca=data.frame(INDIV=pca$sample.id,
PC1=pca$eigenvect[,1],
PC2=pca$eigenvect[,2],
PC3=pca$eigenvect[,3],
PC4=pca$eigenvect[,4],
LOCA=c(rep("Algarve",5),
rep("Bay of Biscay",5),
rep("Gulf of Lion",5),
rep("Costa Calida",5)))
color_med_atl=rev(brewer.pal(n=4,name="RdBu"))
p<-ggplot(data=data_pca,aes(x=PC1,y=PC2,label=INDIV))+
theme_minimal()+
theme(panel.grid=element_blank(),
panel.border=element_rect(fill="transparent"),
plot.title=element_text(hjust=0.5))+
geom_hline(yintercept=0,lty=2)+
geom_vline(xintercept=0,lty=2)+
geom_point(size=3,aes(col=LOCA))+
xlab(paste("PCA 1 (",round(pca$varprop[1]*100,2),"% )",sep=""))+
ylab(paste("PCA 2 (",round(pca$varprop[2]*100,2),"% )",sep=""))+
scale_colour_manual(name="Location",
values=c(color_med_atl[2],
color_med_atl[1],
color_med_atl[3],
color_med_atl[4]))
p1<-p
p<-ggplot(data=data_pca,aes(x=PC3,y=PC4,label=INDIV))+
theme_minimal()+
theme(panel.grid=element_blank(),
panel.border=element_rect(fill="transparent"),
plot.title=element_text(hjust=0.5))+
geom_hline(yintercept=0,lty=2)+
geom_vline(xintercept=0,lty=2)+
geom_point(size=3,aes(col=LOCA))+
xlab(paste("PCA 3 (",round(pca$varprop[3]*100,2),"% )",sep=""))+
ylab(paste("PCA 4 (",round(pca$varprop[4]*100,2),"% )",sep=""))+
scale_colour_manual(name="Location",
values=c(color_med_atl[2],
color_med_atl[1],
color_med_atl[3],
color_med_atl[4]))
p2<-p
data_varpop=data.frame(PC=factor(paste("P",seq(1,10),sep=""),levels=paste("P",seq(1,10),sep="")),VAR=pca$varprop[1:10])
pp<-ggplot(data_varpop,aes(x=PC,y=VAR))+
geom_bar(stat='identity',fill="dodgerblue2",alpha=0.25)+
theme_classic()+
xlab("Principal Component")+
ylab("Variation explained (%)")
```
```{r}
subplot(ggplotly(p1)%>% layout(legend = list(orientation = "h", x = 0.2, y =-0.15)), ggplotly(p2)%>%hide_legend(), ggplotly(pp)%>%hide_legend(), titleX=T,titleY=T,margin=0.035,widths=c(0.375,0.425,0.2),which_layout=1) %>% partial_bundle()
```
### maf = 0.15
```{r}
pca=PCA_list$All_filtered$maf0.15[[1]]
data_pca=data.frame(INDIV=pca$sample.id,
PC1=pca$eigenvect[,1],
PC2=pca$eigenvect[,2],
PC3=pca$eigenvect[,3],
PC4=pca$eigenvect[,4],
LOCA=c(rep("Algarve",5),
rep("Bay of Biscay",5),
rep("Gulf of Lion",5),
rep("Costa Calida",5)))
color_med_atl=rev(brewer.pal(n=4,name="RdBu"))
p<-ggplot(data=data_pca,aes(x=PC1,y=PC2,label=INDIV))+
theme_minimal()+
theme(panel.grid=element_blank(),
panel.border=element_rect(fill="transparent"),
plot.title=element_text(hjust=0.5))+
geom_hline(yintercept=0,lty=2)+
geom_vline(xintercept=0,lty=2)+
geom_point(size=3,aes(col=LOCA))+
xlab(paste("PCA 1 (",round(pca$varprop[1]*100,2),"% )",sep=""))+
ylab(paste("PCA 2 (",round(pca$varprop[2]*100,2),"% )",sep=""))+
scale_colour_manual(name="Location",
values=c(color_med_atl[2],
color_med_atl[1],
color_med_atl[3],
color_med_atl[4]))
p1<-p
p<-ggplot(data=data_pca,aes(x=PC3,y=PC4,label=INDIV))+
theme_minimal()+
theme(panel.grid=element_blank(),
panel.border=element_rect(fill="transparent"),
plot.title=element_text(hjust=0.5))+
geom_hline(yintercept=0,lty=2)+
geom_vline(xintercept=0,lty=2)+
geom_point(size=3,aes(col=LOCA))+
xlab(paste("PCA 3 (",round(pca$varprop[3]*100,2),"% )",sep=""))+
ylab(paste("PCA 4 (",round(pca$varprop[4]*100,2),"% )",sep=""))+
scale_colour_manual(name="Location",
values=c(color_med_atl[2],
color_med_atl[1],
color_med_atl[3],
color_med_atl[4]))
p2<-p
data_varpop=data.frame(PC=factor(paste("P",seq(1,10),sep=""),levels=paste("P",seq(1,10),sep="")),VAR=pca$varprop[1:10])
pp<-ggplot(data_varpop,aes(x=PC,y=VAR))+
geom_bar(stat='identity',fill="dodgerblue2",alpha=0.25)+
theme_classic()+
xlab("Principal Component")+
ylab("Variation explained (%)")
```
```{r}
subplot(ggplotly(p1)%>% layout(legend = list(orientation = "h", x = 0.2, y =-0.15)), ggplotly(p2)%>%hide_legend(), ggplotly(pp)%>%hide_legend(), titleX=T,titleY=T,margin=0.035,widths=c(0.375,0.425,0.2),which_layout=1) %>% partial_bundle()
```
### maf = 0.20
```{r}
pca=PCA_list$All_filtered$maf0.2[[1]]
data_pca=data.frame(INDIV=pca$sample.id,
PC1=pca$eigenvect[,1],
PC2=pca$eigenvect[,2],
PC3=pca$eigenvect[,3],
PC4=pca$eigenvect[,4],
LOCA=c(rep("Algarve",5),
rep("Bay of Biscay",5),
rep("Gulf of Lion",5),
rep("Costa Calida",5)))
color_med_atl=rev(brewer.pal(n=4,name="RdBu"))
p<-ggplot(data=data_pca,aes(x=PC1,y=PC2,label=INDIV))+
theme_minimal()+
theme(panel.grid=element_blank(),
panel.border=element_rect(fill="transparent"),
plot.title=element_text(hjust=0.5))+
geom_hline(yintercept=0,lty=2)+
geom_vline(xintercept=0,lty=2)+
geom_point(size=3,aes(col=LOCA))+
xlab(paste("PCA 1 (",round(pca$varprop[1]*100,2),"% )",sep=""))+
ylab(paste("PCA 2 (",round(pca$varprop[2]*100,2),"% )",sep=""))+
scale_colour_manual(name="Location",
values=c(color_med_atl[2],
color_med_atl[1],
color_med_atl[3],
color_med_atl[4]))
p1<-p
p<-ggplot(data=data_pca,aes(x=PC3,y=PC4,label=INDIV))+
theme_minimal()+
theme(panel.grid=element_blank(),
panel.border=element_rect(fill="transparent"),
plot.title=element_text(hjust=0.5))+
geom_hline(yintercept=0,lty=2)+
geom_vline(xintercept=0,lty=2)+
geom_point(size=3,aes(col=LOCA))+
xlab(paste("PCA 3 (",round(pca$varprop[3]*100,2),"% )",sep=""))+
ylab(paste("PCA 4 (",round(pca$varprop[4]*100,2),"% )",sep=""))+
scale_colour_manual(name="Location",
values=c(color_med_atl[2],
color_med_atl[1],
color_med_atl[3],
color_med_atl[4]))
p2<-p
data_varpop=data.frame(PC=factor(paste("P",seq(1,10),sep=""),levels=paste("P",seq(1,10),sep="")),VAR=pca$varprop[1:10])
pp<-ggplot(data_varpop,aes(x=PC,y=VAR))+
geom_bar(stat='identity',fill="dodgerblue2",alpha=0.25)+
theme_classic()+
xlab("Principal Component")+
ylab("Variation explained (%)")
```
```{r}
subplot(ggplotly(p1)%>% layout(legend = list(orientation = "h", x = 0.2, y =-0.15)), ggplotly(p2)%>%hide_legend(), ggplotly(pp)%>%hide_legend(), titleX=T,titleY=T,margin=0.035,widths=c(0.375,0.425,0.2),which_layout=1) %>% partial_bundle()
```
### maf = 0.25
```{r}
pca=PCA_list$All_filtered$maf0.25[[1]]
data_pca=data.frame(INDIV=pca$sample.id,
PC1=pca$eigenvect[,1],
PC2=pca$eigenvect[,2],
PC3=pca$eigenvect[,3],
PC4=pca$eigenvect[,4],
LOCA=c(rep("Algarve",5),
rep("Bay of Biscay",5),
rep("Gulf of Lion",5),
rep("Costa Calida",5)))
color_med_atl=rev(brewer.pal(n=4,name="RdBu"))
p<-ggplot(data=data_pca,aes(x=PC1,y=PC2,label=INDIV))+
theme_minimal()+
theme(panel.grid=element_blank(),
panel.border=element_rect(fill="transparent"),
plot.title=element_text(hjust=0.5))+
geom_hline(yintercept=0,lty=2)+
geom_vline(xintercept=0,lty=2)+
geom_point(size=3,aes(col=LOCA))+
xlab(paste("PCA 1 (",round(pca$varprop[1]*100,2),"% )",sep=""))+
ylab(paste("PCA 2 (",round(pca$varprop[2]*100,2),"% )",sep=""))+
scale_colour_manual(name="Location",
values=c(color_med_atl[2],
color_med_atl[1],
color_med_atl[3],
color_med_atl[4]))
p1<-p
p<-ggplot(data=data_pca,aes(x=PC3,y=PC4,label=INDIV))+
theme_minimal()+
theme(panel.grid=element_blank(),
panel.border=element_rect(fill="transparent"),
plot.title=element_text(hjust=0.5))+
geom_hline(yintercept=0,lty=2)+
geom_vline(xintercept=0,lty=2)+
geom_point(size=3,aes(col=LOCA))+
xlab(paste("PCA 3 (",round(pca$varprop[3]*100,2),"% )",sep=""))+
ylab(paste("PCA 4 (",round(pca$varprop[4]*100,2),"% )",sep=""))+
scale_colour_manual(name="Location",
values=c(color_med_atl[2],
color_med_atl[1],
color_med_atl[3],
color_med_atl[4]))
p2<-p
data_varpop=data.frame(PC=factor(paste("P",seq(1,10),sep=""),levels=paste("P",seq(1,10),sep="")),VAR=pca$varprop[1:10])
pp<-ggplot(data_varpop,aes(x=PC,y=VAR))+
geom_bar(stat='identity',fill="dodgerblue2",alpha=0.25)+
theme_classic()+
xlab("Principal Component")+
ylab("Variation explained (%)")
```
```{r}
subplot(ggplotly(p1)%>% layout(legend = list(orientation = "h", x = 0.2, y =-0.15)), ggplotly(p2)%>%hide_legend(), ggplotly(pp)%>%hide_legend(), titleX=T,titleY=T,margin=0.035,widths=c(0.375,0.425,0.2),which_layout=1) %>% partial_bundle()
```
### maf = 0.30
```{r}
pca=PCA_list$All_filtered$maf0.3[[1]]
data_pca=data.frame(INDIV=pca$sample.id,
PC1=pca$eigenvect[,1],
PC2=pca$eigenvect[,2],
PC3=pca$eigenvect[,3],
PC4=pca$eigenvect[,4],
LOCA=c(rep("Algarve",5),
rep("Bay of Biscay",5),
rep("Gulf of Lion",5),
rep("Costa Calida",5)))
color_med_atl=rev(brewer.pal(n=4,name="RdBu"))
p<-ggplot(data=data_pca,aes(x=PC1,y=PC2,label=INDIV))+
theme_minimal()+
theme(panel.grid=element_blank(),
panel.border=element_rect(fill="transparent"),
plot.title=element_text(hjust=0.5))+
geom_hline(yintercept=0,lty=2)+
geom_vline(xintercept=0,lty=2)+
geom_point(size=3,aes(col=LOCA))+
xlab(paste("PCA 1 (",round(pca$varprop[1]*100,2),"% )",sep=""))+
ylab(paste("PCA 2 (",round(pca$varprop[2]*100,2),"% )",sep=""))+
scale_colour_manual(name="Location",
values=c(color_med_atl[2],
color_med_atl[1],
color_med_atl[3],
color_med_atl[4]))
p1<-p
p<-ggplot(data=data_pca,aes(x=PC3,y=PC4,label=INDIV))+
theme_minimal()+
theme(panel.grid=element_blank(),
panel.border=element_rect(fill="transparent"),
plot.title=element_text(hjust=0.5))+
geom_hline(yintercept=0,lty=2)+
geom_vline(xintercept=0,lty=2)+
geom_point(size=3,aes(col=LOCA))+
xlab(paste("PCA 3 (",round(pca$varprop[3]*100,2),"% )",sep=""))+
ylab(paste("PCA 4 (",round(pca$varprop[4]*100,2),"% )",sep=""))+
scale_colour_manual(name="Location",
values=c(color_med_atl[2],
color_med_atl[1],
color_med_atl[3],
color_med_atl[4]))
p2<-p
data_varpop=data.frame(PC=factor(paste("P",seq(1,10),sep=""),levels=paste("P",seq(1,10),sep="")),VAR=pca$varprop[1:10])
pp<-ggplot(data_varpop,aes(x=PC,y=VAR))+
geom_bar(stat='identity',fill="dodgerblue2",alpha=0.25)+
theme_classic()+
xlab("Principal Component")+
ylab("Variation explained (%)")
```
```{r}
subplot(ggplotly(p1)%>% layout(legend = list(orientation = "h", x = 0.2, y =-0.15)), ggplotly(p2)%>%hide_legend(), ggplotly(pp)%>%hide_legend(), titleX=T,titleY=T,margin=0.035,widths=c(0.375,0.425,0.2),which_layout=1) %>% partial_bundle()
```
### maf = 0.35
```{r}
pca=PCA_list$All_filtered$maf0.35[[1]]
data_pca=data.frame(INDIV=pca$sample.id,
PC1=pca$eigenvect[,1],
PC2=pca$eigenvect[,2],
PC3=pca$eigenvect[,3],
PC4=pca$eigenvect[,4],
LOCA=c(rep("Algarve",5),
rep("Bay of Biscay",5),
rep("Gulf of Lion",5),
rep("Costa Calida",5)))
color_med_atl=rev(brewer.pal(n=4,name="RdBu"))
p<-ggplot(data=data_pca,aes(x=PC1,y=PC2,label=INDIV))+
theme_minimal()+
theme(panel.grid=element_blank(),
panel.border=element_rect(fill="transparent"),
plot.title=element_text(hjust=0.5))+
geom_hline(yintercept=0,lty=2)+
geom_vline(xintercept=0,lty=2)+
geom_point(size=3,aes(col=LOCA))+
xlab(paste("PCA 1 (",round(pca$varprop[1]*100,2),"% )",sep=""))+
ylab(paste("PCA 2 (",round(pca$varprop[2]*100,2),"% )",sep=""))+
scale_colour_manual(name="Location",
values=c(color_med_atl[2],
color_med_atl[1],
color_med_atl[3],
color_med_atl[4]))
p1<-p
p<-ggplot(data=data_pca,aes(x=PC3,y=PC4,label=INDIV))+
theme_minimal()+
theme(panel.grid=element_blank(),
panel.border=element_rect(fill="transparent"),
plot.title=element_text(hjust=0.5))+
geom_hline(yintercept=0,lty=2)+
geom_vline(xintercept=0,lty=2)+
geom_point(size=3,aes(col=LOCA))+
xlab(paste("PCA 3 (",round(pca$varprop[3]*100,2),"% )",sep=""))+
ylab(paste("PCA 4 (",round(pca$varprop[4]*100,2),"% )",sep=""))+
scale_colour_manual(name="Location",
values=c(color_med_atl[2],
color_med_atl[1],
color_med_atl[3],
color_med_atl[4]))
p2<-p
data_varpop=data.frame(PC=factor(paste("P",seq(1,10),sep=""),levels=paste("P",seq(1,10),sep="")),VAR=pca$varprop[1:10])
pp<-ggplot(data_varpop,aes(x=PC,y=VAR))+
geom_bar(stat='identity',fill="dodgerblue2",alpha=0.25)+
theme_classic()+
xlab("Principal Component")+
ylab("Variation explained (%)")
```
```{r}
subplot(ggplotly(p1)%>% layout(legend = list(orientation = "h", x = 0.2, y =-0.15)), ggplotly(p2)%>%hide_legend(), ggplotly(pp)%>%hide_legend(), titleX=T,titleY=T,margin=0.035,widths=c(0.375,0.425,0.2),which_layout=1) %>% partial_bundle()
```
### maf = 0.40
```{r}
pca=PCA_list$All_filtered$maf0.4[[1]]
data_pca=data.frame(INDIV=pca$sample.id,
PC1=pca$eigenvect[,1],
PC2=pca$eigenvect[,2],
PC3=pca$eigenvect[,3],
PC4=pca$eigenvect[,4],
LOCA=c(rep("Algarve",5),
rep("Bay of Biscay",5),
rep("Gulf of Lion",5),
rep("Costa Calida",5)))
color_med_atl=rev(brewer.pal(n=4,name="RdBu"))
p<-ggplot(data=data_pca,aes(x=PC1,y=PC2,label=INDIV))+
theme_minimal()+
theme(panel.grid=element_blank(),
panel.border=element_rect(fill="transparent"),
plot.title=element_text(hjust=0.5))+
geom_hline(yintercept=0,lty=2)+
geom_vline(xintercept=0,lty=2)+
geom_point(size=3,aes(col=LOCA))+
xlab(paste("PCA 1 (",round(pca$varprop[1]*100,2),"% )",sep=""))+
ylab(paste("PCA 2 (",round(pca$varprop[2]*100,2),"% )",sep=""))+
scale_colour_manual(name="Location",
values=c(color_med_atl[2],
color_med_atl[1],
color_med_atl[3],
color_med_atl[4]))
p1<-p
p<-ggplot(data=data_pca,aes(x=PC3,y=PC4,label=INDIV))+
theme_minimal()+
theme(panel.grid=element_blank(),
panel.border=element_rect(fill="transparent"),
plot.title=element_text(hjust=0.5))+
geom_hline(yintercept=0,lty=2)+
geom_vline(xintercept=0,lty=2)+
geom_point(size=3,aes(col=LOCA))+
xlab(paste("PCA 3 (",round(pca$varprop[3]*100,2),"% )",sep=""))+
ylab(paste("PCA 4 (",round(pca$varprop[4]*100,2),"% )",sep=""))+
scale_colour_manual(name="Location",
values=c(color_med_atl[2],
color_med_atl[1],
color_med_atl[3],
color_med_atl[4]))
p2<-p
data_varpop=data.frame(PC=factor(paste("P",seq(1,10),sep=""),levels=paste("P",seq(1,10),sep="")),VAR=pca$varprop[1:10])
pp<-ggplot(data_varpop,aes(x=PC,y=VAR))+
geom_bar(stat='identity',fill="dodgerblue2",alpha=0.25)+
theme_classic()+
xlab("Principal Component")+
ylab("Variation explained (%)")
```
```{r}
subplot(ggplotly(p1)%>% layout(legend = list(orientation = "h", x = 0.2, y =-0.15)), ggplotly(p2)%>%hide_legend(), ggplotly(pp)%>%hide_legend(), titleX=T,titleY=T,margin=0.035,widths=c(0.375,0.425,0.2),which_layout=1) %>% partial_bundle()
```
### maf = 0.45
```{r}
pca=PCA_list$All_filtered$maf0.45[[1]]
data_pca=data.frame(INDIV=pca$sample.id,
PC1=pca$eigenvect[,1],
PC2=pca$eigenvect[,2],
PC3=pca$eigenvect[,3],
PC4=pca$eigenvect[,4],
LOCA=c(rep("Algarve",5),
rep("Bay of Biscay",5),
rep("Gulf of Lion",5),
rep("Costa Calida",5)))
color_med_atl=rev(brewer.pal(n=4,name="RdBu"))
p<-ggplot(data=data_pca,aes(x=PC1,y=PC2,label=INDIV))+
theme_minimal()+
theme(panel.grid=element_blank(),
panel.border=element_rect(fill="transparent"),
plot.title=element_text(hjust=0.5))+
geom_hline(yintercept=0,lty=2)+
geom_vline(xintercept=0,lty=2)+
geom_point(size=3,aes(col=LOCA))+
xlab(paste("PCA 1 (",round(pca$varprop[1]*100,2),"% )",sep=""))+
ylab(paste("PCA 2 (",round(pca$varprop[2]*100,2),"% )",sep=""))+
scale_colour_manual(name="Location",
values=c(color_med_atl[2],
color_med_atl[1],
color_med_atl[3],
color_med_atl[4]))
p1<-p
p<-ggplot(data=data_pca,aes(x=PC3,y=PC4,label=INDIV))+
theme_minimal()+
theme(panel.grid=element_blank(),
panel.border=element_rect(fill="transparent"),
plot.title=element_text(hjust=0.5))+
geom_hline(yintercept=0,lty=2)+
geom_vline(xintercept=0,lty=2)+
geom_point(size=3,aes(col=LOCA))+
xlab(paste("PCA 3 (",round(pca$varprop[3]*100,2),"% )",sep=""))+
ylab(paste("PCA 4 (",round(pca$varprop[4]*100,2),"% )",sep=""))+
scale_colour_manual(name="Location",
values=c(color_med_atl[2],
color_med_atl[1],
color_med_atl[3],
color_med_atl[4]))
p2<-p
data_varpop=data.frame(PC=factor(paste("P",seq(1,10),sep=""),levels=paste("P",seq(1,10),sep="")),VAR=pca$varprop[1:10])
pp<-ggplot(data_varpop,aes(x=PC,y=VAR))+
geom_bar(stat='identity',fill="dodgerblue2",alpha=0.25)+
theme_classic()+
xlab("Principal Component")+
ylab("Variation explained (%)")
```
```{r}
subplot(ggplotly(p1)%>% layout(legend = list(orientation = "h", x = 0.2, y =-0.15)), ggplotly(p2)%>%hide_legend(), ggplotly(pp)%>%hide_legend(), titleX=T,titleY=T,margin=0.035,widths=c(0.375,0.425,0.2),which_layout=1) %>% partial_bundle()
```
### maf = 0.50
```{r}
pca=PCA_list$All_filtered$maf0.5[[1]]
data_pca=data.frame(INDIV=pca$sample.id,
PC1=pca$eigenvect[,1],
PC2=pca$eigenvect[,2],
PC3=pca$eigenvect[,3],
PC4=pca$eigenvect[,4],
LOCA=c(rep("Algarve",5),
rep("Bay of Biscay",5),
rep("Gulf of Lion",5),
rep("Costa Calida",5)))
color_med_atl=rev(brewer.pal(n=4,name="RdBu"))
p<-ggplot(data=data_pca,aes(x=PC1,y=PC2,label=INDIV))+
theme_minimal()+
theme(panel.grid=element_blank(),
panel.border=element_rect(fill="transparent"),
plot.title=element_text(hjust=0.5))+
geom_hline(yintercept=0,lty=2)+
geom_vline(xintercept=0,lty=2)+
geom_point(size=3,aes(col=LOCA))+
xlab(paste("PCA 1 (",round(pca$varprop[1]*100,2),"% )",sep=""))+
ylab(paste("PCA 2 (",round(pca$varprop[2]*100,2),"% )",sep=""))+
scale_colour_manual(name="Location",
values=c(color_med_atl[2],
color_med_atl[1],
color_med_atl[3],
color_med_atl[4]))
p1<-p
p<-ggplot(data=data_pca,aes(x=PC3,y=PC4,label=INDIV))+
theme_minimal()+
theme(panel.grid=element_blank(),
panel.border=element_rect(fill="transparent"),
plot.title=element_text(hjust=0.5))+
geom_hline(yintercept=0,lty=2)+
geom_vline(xintercept=0,lty=2)+
geom_point(size=3,aes(col=LOCA))+
xlab(paste("PCA 3 (",round(pca$varprop[3]*100,2),"% )",sep=""))+
ylab(paste("PCA 4 (",round(pca$varprop[4]*100,2),"% )",sep=""))+
scale_colour_manual(name="Location",
values=c(color_med_atl[2],
color_med_atl[1],
color_med_atl[3],
color_med_atl[4]))
p2<-p
data_varpop=data.frame(PC=factor(paste("P",seq(1,10),sep=""),levels=paste("P",seq(1,10),sep="")),VAR=pca$varprop[1:10])
pp<-ggplot(data_varpop,aes(x=PC,y=VAR))+
geom_bar(stat='identity',fill="dodgerblue2",alpha=0.25)+
theme_classic()+
xlab("Principal Component")+
ylab("Variation explained (%)")
```
```{r}
subplot(ggplotly(p1)%>% layout(legend = list(orientation = "h", x = 0.2, y =-0.15)), ggplotly(p2)%>%hide_legend(), ggplotly(pp)%>%hide_legend(), titleX=T,titleY=T,margin=0.035,widths=c(0.375,0.425,0.2),which_layout=1) %>% partial_bundle()
```
Row {.tabset data-height=50}
-----------------------
<center>
<font size="6">**Pruned filtered SNPS**</font>
</center>
Row {.tabset data-height=600}
-----------------------
### maf = 0
```{r}
pca=PCA_list$Prune_filtered$maf0[[1]]
data_pca=data.frame(INDIV=pca$sample.id,
PC1=pca$eigenvect[,1],
PC2=pca$eigenvect[,2],
PC3=pca$eigenvect[,3],
PC4=pca$eigenvect[,4],
LOCA=c(rep("Algarve",5),
rep("Bay of Biscay",5),
rep("Gulf of Lion",5),
rep("Costa Calida",5)))
color_med_atl=rev(brewer.pal(n=4,name="RdBu"))
p<-ggplot(data=data_pca,aes(x=PC1,y=PC2,label=INDIV))+
theme_minimal()+
theme(panel.grid=element_blank(),
panel.border=element_rect(fill="transparent"),
plot.title=element_text(hjust=0.5))+
geom_hline(yintercept=0,lty=2)+
geom_vline(xintercept=0,lty=2)+
geom_point(size=3,aes(col=LOCA))+
xlab(paste("PCA 1 (",round(pca$varprop[1]*100,2),"% )",sep=""))+
ylab(paste("PCA 2 (",round(pca$varprop[2]*100,2),"% )",sep=""))+
scale_colour_manual(name="Location",
values=c(color_med_atl[2],
color_med_atl[1],
color_med_atl[3],
color_med_atl[4]))
p1<-p
p<-ggplot(data=data_pca,aes(x=PC3,y=PC4,label=INDIV))+
theme_minimal()+
theme(panel.grid=element_blank(),
panel.border=element_rect(fill="transparent"),
plot.title=element_text(hjust=0.5))+
geom_hline(yintercept=0,lty=2)+
geom_vline(xintercept=0,lty=2)+
geom_point(size=3,aes(col=LOCA))+
xlab(paste("PCA 3 (",round(pca$varprop[3]*100,2),"% )",sep=""))+
ylab(paste("PCA 4 (",round(pca$varprop[4]*100,2),"% )",sep=""))+
scale_colour_manual(name="Location",
values=c(color_med_atl[2],
color_med_atl[1],
color_med_atl[3],
color_med_atl[4]))
p2<-p
data_varpop=data.frame(PC=factor(paste("P",seq(1,10),sep=""),levels=paste("P",seq(1,10),sep="")),VAR=pca$varprop[1:10])
pp<-ggplot(data_varpop,aes(x=PC,y=VAR))+
geom_bar(stat='identity',fill="dodgerblue2",alpha=0.25)+
theme_classic()+
xlab("Principal Component")+
ylab("Variation explained (%)")
```
```{r}
subplot(ggplotly(p1)%>% layout(legend = list(orientation = "h", x = 0.2, y =-0.15)), ggplotly(p2)%>%hide_legend(), ggplotly(pp)%>%hide_legend(), titleX=T,titleY=T,margin=0.035,widths=c(0.375,0.425,0.2),which_layout=1) %>% partial_bundle()
```
### maf = 0.05
```{r}
pca=PCA_list$Prune_filtered$maf0.05[[1]]
data_pca=data.frame(INDIV=pca$sample.id,
PC1=pca$eigenvect[,1],
PC2=pca$eigenvect[,2],
PC3=pca$eigenvect[,3],
PC4=pca$eigenvect[,4],
LOCA=c(rep("Algarve",5),
rep("Bay of Biscay",5),
rep("Gulf of Lion",5),
rep("Costa Calida",5)))
color_med_atl=rev(brewer.pal(n=4,name="RdBu"))
p<-ggplot(data=data_pca,aes(x=PC1,y=PC2,label=INDIV))+
theme_minimal()+
theme(panel.grid=element_blank(),
panel.border=element_rect(fill="transparent"),
plot.title=element_text(hjust=0.5))+
geom_hline(yintercept=0,lty=2)+
geom_vline(xintercept=0,lty=2)+
geom_point(size=3,aes(col=LOCA))+
xlab(paste("PCA 1 (",round(pca$varprop[1]*100,2),"% )",sep=""))+
ylab(paste("PCA 2 (",round(pca$varprop[2]*100,2),"% )",sep=""))+
scale_colour_manual(name="Location",
values=c(color_med_atl[2],
color_med_atl[1],
color_med_atl[3],
color_med_atl[4]))
p1<-p
p<-ggplot(data=data_pca,aes(x=PC3,y=PC4,label=INDIV))+
theme_minimal()+
theme(panel.grid=element_blank(),
panel.border=element_rect(fill="transparent"),
plot.title=element_text(hjust=0.5))+
geom_hline(yintercept=0,lty=2)+
geom_vline(xintercept=0,lty=2)+
geom_point(size=3,aes(col=LOCA))+
xlab(paste("PCA 3 (",round(pca$varprop[3]*100,2),"% )",sep=""))+
ylab(paste("PCA 4 (",round(pca$varprop[4]*100,2),"% )",sep=""))+
scale_colour_manual(name="Location",
values=c(color_med_atl[2],
color_med_atl[1],
color_med_atl[3],
color_med_atl[4]))
p2<-p
data_varpop=data.frame(PC=factor(paste("P",seq(1,10),sep=""),levels=paste("P",seq(1,10),sep="")),VAR=pca$varprop[1:10])
pp<-ggplot(data_varpop,aes(x=PC,y=VAR))+
geom_bar(stat='identity',fill="dodgerblue2",alpha=0.25)+
theme_classic()+
xlab("Principal Component")+
ylab("Variation explained (%)")
```
```{r}
subplot(ggplotly(p1)%>% layout(legend = list(orientation = "h", x = 0.2, y =-0.15)), ggplotly(p2)%>%hide_legend(), ggplotly(pp)%>%hide_legend(), titleX=T,titleY=T,margin=0.035,widths=c(0.375,0.425,0.2),which_layout=1) %>% partial_bundle()
```
### maf = 0.1
```{r}
pca=PCA_list$Prune_filtered$maf0.1[[1]]
data_pca=data.frame(INDIV=pca$sample.id,
PC1=pca$eigenvect[,1],
PC2=pca$eigenvect[,2],
PC3=pca$eigenvect[,3],
PC4=pca$eigenvect[,4],
LOCA=c(rep("Algarve",5),
rep("Bay of Biscay",5),
rep("Gulf of Lion",5),
rep("Costa Calida",5)))
color_med_atl=rev(brewer.pal(n=4,name="RdBu"))
p<-ggplot(data=data_pca,aes(x=PC1,y=PC2,label=INDIV))+
theme_minimal()+
theme(panel.grid=element_blank(),
panel.border=element_rect(fill="transparent"),
plot.title=element_text(hjust=0.5))+
geom_hline(yintercept=0,lty=2)+
geom_vline(xintercept=0,lty=2)+
geom_point(size=3,aes(col=LOCA))+
xlab(paste("PCA 1 (",round(pca$varprop[1]*100,2),"% )",sep=""))+
ylab(paste("PCA 2 (",round(pca$varprop[2]*100,2),"% )",sep=""))+
scale_colour_manual(name="Location",
values=c(color_med_atl[2],
color_med_atl[1],
color_med_atl[3],
color_med_atl[4]))
p1<-p
p<-ggplot(data=data_pca,aes(x=PC3,y=PC4,label=INDIV))+
theme_minimal()+
theme(panel.grid=element_blank(),
panel.border=element_rect(fill="transparent"),
plot.title=element_text(hjust=0.5))+
geom_hline(yintercept=0,lty=2)+
geom_vline(xintercept=0,lty=2)+
geom_point(size=3,aes(col=LOCA))+
xlab(paste("PCA 3 (",round(pca$varprop[3]*100,2),"% )",sep=""))+
ylab(paste("PCA 4 (",round(pca$varprop[4]*100,2),"% )",sep=""))+
scale_colour_manual(name="Location",
values=c(color_med_atl[2],
color_med_atl[1],
color_med_atl[3],
color_med_atl[4]))
p2<-p
data_varpop=data.frame(PC=factor(paste("P",seq(1,10),sep=""),levels=paste("P",seq(1,10),sep="")),VAR=pca$varprop[1:10])
pp<-ggplot(data_varpop,aes(x=PC,y=VAR))+
geom_bar(stat='identity',fill="dodgerblue2",alpha=0.25)+
theme_classic()+
xlab("Principal Component")+
ylab("Variation explained (%)")
```
```{r}
subplot(ggplotly(p1)%>% layout(legend = list(orientation = "h", x = 0.2, y =-0.15)), ggplotly(p2)%>%hide_legend(), ggplotly(pp)%>%hide_legend(), titleX=T,titleY=T,margin=0.035,widths=c(0.375,0.425,0.2),which_layout=1) %>% partial_bundle()
```
### maf = 0.15
```{r}
pca=PCA_list$Prune_filtered$maf0.15[[1]]
data_pca=data.frame(INDIV=pca$sample.id,
PC1=pca$eigenvect[,1],
PC2=pca$eigenvect[,2],
PC3=pca$eigenvect[,3],
PC4=pca$eigenvect[,4],
LOCA=c(rep("Algarve",5),
rep("Bay of Biscay",5),
rep("Gulf of Lion",5),
rep("Costa Calida",5)))
color_med_atl=rev(brewer.pal(n=4,name="RdBu"))
p<-ggplot(data=data_pca,aes(x=PC1,y=PC2,label=INDIV))+
theme_minimal()+
theme(panel.grid=element_blank(),
panel.border=element_rect(fill="transparent"),
plot.title=element_text(hjust=0.5))+
geom_hline(yintercept=0,lty=2)+
geom_vline(xintercept=0,lty=2)+
geom_point(size=3,aes(col=LOCA))+
xlab(paste("PCA 1 (",round(pca$varprop[1]*100,2),"% )",sep=""))+
ylab(paste("PCA 2 (",round(pca$varprop[2]*100,2),"% )",sep=""))+
scale_colour_manual(name="Location",
values=c(color_med_atl[2],
color_med_atl[1],
color_med_atl[3],
color_med_atl[4]))
p1<-p
p<-ggplot(data=data_pca,aes(x=PC3,y=PC4,label=INDIV))+
theme_minimal()+
theme(panel.grid=element_blank(),
panel.border=element_rect(fill="transparent"),
plot.title=element_text(hjust=0.5))+
geom_hline(yintercept=0,lty=2)+
geom_vline(xintercept=0,lty=2)+
geom_point(size=3,aes(col=LOCA))+
xlab(paste("PCA 3 (",round(pca$varprop[3]*100,2),"% )",sep=""))+
ylab(paste("PCA 4 (",round(pca$varprop[4]*100,2),"% )",sep=""))+
scale_colour_manual(name="Location",
values=c(color_med_atl[2],
color_med_atl[1],
color_med_atl[3],
color_med_atl[4]))
p2<-p
data_varpop=data.frame(PC=factor(paste("P",seq(1,10),sep=""),levels=paste("P",seq(1,10),sep="")),VAR=pca$varprop[1:10])
pp<-ggplot(data_varpop,aes(x=PC,y=VAR))+
geom_bar(stat='identity',fill="dodgerblue2",alpha=0.25)+
theme_classic()+
xlab("Principal Component")+
ylab("Variation explained (%)")
```
```{r}
subplot(ggplotly(p1)%>% layout(legend = list(orientation = "h", x = 0.2, y =-0.15)), ggplotly(p2)%>%hide_legend(), ggplotly(pp)%>%hide_legend(), titleX=T,titleY=T,margin=0.035,widths=c(0.375,0.425,0.2),which_layout=1) %>% partial_bundle()
```
### maf = 0.20
```{r}
pca=PCA_list$Prune_filtered$maf0.2[[1]]
data_pca=data.frame(INDIV=pca$sample.id,
PC1=pca$eigenvect[,1],
PC2=pca$eigenvect[,2],
PC3=pca$eigenvect[,3],
PC4=pca$eigenvect[,4],
LOCA=c(rep("Algarve",5),
rep("Bay of Biscay",5),
rep("Gulf of Lion",5),
rep("Costa Calida",5)))
color_med_atl=rev(brewer.pal(n=4,name="RdBu"))
p<-ggplot(data=data_pca,aes(x=PC1,y=PC2,label=INDIV))+
theme_minimal()+
theme(panel.grid=element_blank(),
panel.border=element_rect(fill="transparent"),
plot.title=element_text(hjust=0.5))+
geom_hline(yintercept=0,lty=2)+
geom_vline(xintercept=0,lty=2)+
geom_point(size=3,aes(col=LOCA))+
xlab(paste("PCA 1 (",round(pca$varprop[1]*100,2),"% )",sep=""))+
ylab(paste("PCA 2 (",round(pca$varprop[2]*100,2),"% )",sep=""))+
scale_colour_manual(name="Location",
values=c(color_med_atl[2],
color_med_atl[1],
color_med_atl[3],
color_med_atl[4]))
p1<-p
p<-ggplot(data=data_pca,aes(x=PC3,y=PC4,label=INDIV))+
theme_minimal()+
theme(panel.grid=element_blank(),
panel.border=element_rect(fill="transparent"),
plot.title=element_text(hjust=0.5))+
geom_hline(yintercept=0,lty=2)+
geom_vline(xintercept=0,lty=2)+
geom_point(size=3,aes(col=LOCA))+
xlab(paste("PCA 3 (",round(pca$varprop[3]*100,2),"% )",sep=""))+
ylab(paste("PCA 4 (",round(pca$varprop[4]*100,2),"% )",sep=""))+
scale_colour_manual(name="Location",
values=c(color_med_atl[2],
color_med_atl[1],
color_med_atl[3],
color_med_atl[4]))
p2<-p
data_varpop=data.frame(PC=factor(paste("P",seq(1,10),sep=""),levels=paste("P",seq(1,10),sep="")),VAR=pca$varprop[1:10])
pp<-ggplot(data_varpop,aes(x=PC,y=VAR))+
geom_bar(stat='identity',fill="dodgerblue2",alpha=0.25)+
theme_classic()+
xlab("Principal Component")+
ylab("Variation explained (%)")
```
```{r}
subplot(ggplotly(p1)%>% layout(legend = list(orientation = "h", x = 0.2, y =-0.15)), ggplotly(p2)%>%hide_legend(), ggplotly(pp)%>%hide_legend(), titleX=T,titleY=T,margin=0.035,widths=c(0.375,0.425,0.2),which_layout=1) %>% partial_bundle()
```
### maf = 0.25
```{r}
pca=PCA_list$Prune_filtered$maf0.25[[1]]
data_pca=data.frame(INDIV=pca$sample.id,
PC1=pca$eigenvect[,1],
PC2=pca$eigenvect[,2],
PC3=pca$eigenvect[,3],
PC4=pca$eigenvect[,4],
LOCA=c(rep("Algarve",5),
rep("Bay of Biscay",5),
rep("Gulf of Lion",5),
rep("Costa Calida",5)))
color_med_atl=rev(brewer.pal(n=4,name="RdBu"))
p<-ggplot(data=data_pca,aes(x=PC1,y=PC2,label=INDIV))+
theme_minimal()+
theme(panel.grid=element_blank(),
panel.border=element_rect(fill="transparent"),
plot.title=element_text(hjust=0.5))+
geom_hline(yintercept=0,lty=2)+
geom_vline(xintercept=0,lty=2)+
geom_point(size=3,aes(col=LOCA))+
xlab(paste("PCA 1 (",round(pca$varprop[1]*100,2),"% )",sep=""))+
ylab(paste("PCA 2 (",round(pca$varprop[2]*100,2),"% )",sep=""))+
scale_colour_manual(name="Location",
values=c(color_med_atl[2],
color_med_atl[1],
color_med_atl[3],
color_med_atl[4]))
p1<-p
p<-ggplot(data=data_pca,aes(x=PC3,y=PC4,label=INDIV))+
theme_minimal()+
theme(panel.grid=element_blank(),
panel.border=element_rect(fill="transparent"),
plot.title=element_text(hjust=0.5))+
geom_hline(yintercept=0,lty=2)+
geom_vline(xintercept=0,lty=2)+
geom_point(size=3,aes(col=LOCA))+
xlab(paste("PCA 3 (",round(pca$varprop[3]*100,2),"% )",sep=""))+
ylab(paste("PCA 4 (",round(pca$varprop[4]*100,2),"% )",sep=""))+
scale_colour_manual(name="Location",
values=c(color_med_atl[2],
color_med_atl[1],
color_med_atl[3],
color_med_atl[4]))
p2<-p
data_varpop=data.frame(PC=factor(paste("P",seq(1,10),sep=""),levels=paste("P",seq(1,10),sep="")),VAR=pca$varprop[1:10])
pp<-ggplot(data_varpop,aes(x=PC,y=VAR))+
geom_bar(stat='identity',fill="dodgerblue2",alpha=0.25)+
theme_classic()+
xlab("Principal Component")+
ylab("Variation explained (%)")
```
```{r}
subplot(ggplotly(p1)%>% layout(legend = list(orientation = "h", x = 0.2, y =-0.15)), ggplotly(p2)%>%hide_legend(), ggplotly(pp)%>%hide_legend(), titleX=T,titleY=T,margin=0.035,widths=c(0.375,0.425,0.2),which_layout=1) %>% partial_bundle()
```
### maf = 0.30
```{r}
pca=PCA_list$Prune_filtered$maf0.3[[1]]
data_pca=data.frame(INDIV=pca$sample.id,
PC1=pca$eigenvect[,1],
PC2=pca$eigenvect[,2],
PC3=pca$eigenvect[,3],
PC4=pca$eigenvect[,4],
LOCA=c(rep("Algarve",5),
rep("Bay of Biscay",5),
rep("Gulf of Lion",5),
rep("Costa Calida",5)))
color_med_atl=rev(brewer.pal(n=4,name="RdBu"))
p<-ggplot(data=data_pca,aes(x=PC1,y=PC2,label=INDIV))+
theme_minimal()+
theme(panel.grid=element_blank(),
panel.border=element_rect(fill="transparent"),
plot.title=element_text(hjust=0.5))+
geom_hline(yintercept=0,lty=2)+
geom_vline(xintercept=0,lty=2)+
geom_point(size=3,aes(col=LOCA))+
xlab(paste("PCA 1 (",round(pca$varprop[1]*100,2),"% )",sep=""))+
ylab(paste("PCA 2 (",round(pca$varprop[2]*100,2),"% )",sep=""))+
scale_colour_manual(name="Location",
values=c(color_med_atl[2],
color_med_atl[1],
color_med_atl[3],
color_med_atl[4]))
p1<-p
p<-ggplot(data=data_pca,aes(x=PC3,y=PC4,label=INDIV))+
theme_minimal()+
theme(panel.grid=element_blank(),
panel.border=element_rect(fill="transparent"),
plot.title=element_text(hjust=0.5))+
geom_hline(yintercept=0,lty=2)+
geom_vline(xintercept=0,lty=2)+
geom_point(size=3,aes(col=LOCA))+
xlab(paste("PCA 3 (",round(pca$varprop[3]*100,2),"% )",sep=""))+
ylab(paste("PCA 4 (",round(pca$varprop[4]*100,2),"% )",sep=""))+
scale_colour_manual(name="Location",
values=c(color_med_atl[2],
color_med_atl[1],
color_med_atl[3],
color_med_atl[4]))
p2<-p
data_varpop=data.frame(PC=factor(paste("P",seq(1,10),sep=""),levels=paste("P",seq(1,10),sep="")),VAR=pca$varprop[1:10])
pp<-ggplot(data_varpop,aes(x=PC,y=VAR))+
geom_bar(stat='identity',fill="dodgerblue2",alpha=0.25)+
theme_classic()+
xlab("Principal Component")+
ylab("Variation explained (%)")
```
```{r}
subplot(ggplotly(p1)%>% layout(legend = list(orientation = "h", x = 0.2, y =-0.15)), ggplotly(p2)%>%hide_legend(), ggplotly(pp)%>%hide_legend(), titleX=T,titleY=T,margin=0.035,widths=c(0.375,0.425,0.2),which_layout=1) %>% partial_bundle()
```
### maf = 0.35
```{r}
pca=PCA_list$Prune_filtered$maf0.35[[1]]
data_pca=data.frame(INDIV=pca$sample.id,
PC1=pca$eigenvect[,1],
PC2=pca$eigenvect[,2],
PC3=pca$eigenvect[,3],
PC4=pca$eigenvect[,4],
LOCA=c(rep("Algarve",5),
rep("Bay of Biscay",5),
rep("Gulf of Lion",5),
rep("Costa Calida",5)))
color_med_atl=rev(brewer.pal(n=4,name="RdBu"))
p<-ggplot(data=data_pca,aes(x=PC1,y=PC2,label=INDIV))+
theme_minimal()+
theme(panel.grid=element_blank(),
panel.border=element_rect(fill="transparent"),
plot.title=element_text(hjust=0.5))+
geom_hline(yintercept=0,lty=2)+
geom_vline(xintercept=0,lty=2)+
geom_point(size=3,aes(col=LOCA))+
xlab(paste("PCA 1 (",round(pca$varprop[1]*100,2),"% )",sep=""))+
ylab(paste("PCA 2 (",round(pca$varprop[2]*100,2),"% )",sep=""))+
scale_colour_manual(name="Location",
values=c(color_med_atl[2],
color_med_atl[1],
color_med_atl[3],
color_med_atl[4]))
p1<-p
p<-ggplot(data=data_pca,aes(x=PC3,y=PC4,label=INDIV))+
theme_minimal()+
theme(panel.grid=element_blank(),
panel.border=element_rect(fill="transparent"),
plot.title=element_text(hjust=0.5))+
geom_hline(yintercept=0,lty=2)+
geom_vline(xintercept=0,lty=2)+
geom_point(size=3,aes(col=LOCA))+
xlab(paste("PCA 3 (",round(pca$varprop[3]*100,2),"% )",sep=""))+
ylab(paste("PCA 4 (",round(pca$varprop[4]*100,2),"% )",sep=""))+
scale_colour_manual(name="Location",
values=c(color_med_atl[2],
color_med_atl[1],
color_med_atl[3],
color_med_atl[4]))
p2<-p
data_varpop=data.frame(PC=factor(paste("P",seq(1,10),sep=""),levels=paste("P",seq(1,10),sep="")),VAR=pca$varprop[1:10])
pp<-ggplot(data_varpop,aes(x=PC,y=VAR))+
geom_bar(stat='identity',fill="dodgerblue2",alpha=0.25)+
theme_classic()+
xlab("Principal Component")+
ylab("Variation explained (%)")
```
```{r}
subplot(ggplotly(p1)%>% layout(legend = list(orientation = "h", x = 0.2, y =-0.15)), ggplotly(p2)%>%hide_legend(), ggplotly(pp)%>%hide_legend(), titleX=T,titleY=T,margin=0.035,widths=c(0.375,0.425,0.2),which_layout=1) %>% partial_bundle()
```
### maf = 0.40
```{r}
pca=PCA_list$Prune_filtered$maf0.4[[1]]
data_pca=data.frame(INDIV=pca$sample.id,
PC1=pca$eigenvect[,1],
PC2=pca$eigenvect[,2],
PC3=pca$eigenvect[,3],
PC4=pca$eigenvect[,4],
LOCA=c(rep("Algarve",5),
rep("Bay of Biscay",5),
rep("Gulf of Lion",5),
rep("Costa Calida",5)))
color_med_atl=rev(brewer.pal(n=4,name="RdBu"))
p<-ggplot(data=data_pca,aes(x=PC1,y=PC2,label=INDIV))+
theme_minimal()+
theme(panel.grid=element_blank(),
panel.border=element_rect(fill="transparent"),
plot.title=element_text(hjust=0.5))+
geom_hline(yintercept=0,lty=2)+
geom_vline(xintercept=0,lty=2)+
geom_point(size=3,aes(col=LOCA))+
xlab(paste("PCA 1 (",round(pca$varprop[1]*100,2),"% )",sep=""))+
ylab(paste("PCA 2 (",round(pca$varprop[2]*100,2),"% )",sep=""))+
scale_colour_manual(name="Location",
values=c(color_med_atl[2],
color_med_atl[1],
color_med_atl[3],
color_med_atl[4]))
p1<-p
p<-ggplot(data=data_pca,aes(x=PC3,y=PC4,label=INDIV))+
theme_minimal()+
theme(panel.grid=element_blank(),
panel.border=element_rect(fill="transparent"),
plot.title=element_text(hjust=0.5))+
geom_hline(yintercept=0,lty=2)+
geom_vline(xintercept=0,lty=2)+
geom_point(size=3,aes(col=LOCA))+
xlab(paste("PCA 3 (",round(pca$varprop[3]*100,2),"% )",sep=""))+
ylab(paste("PCA 4 (",round(pca$varprop[4]*100,2),"% )",sep=""))+
scale_colour_manual(name="Location",
values=c(color_med_atl[2],
color_med_atl[1],
color_med_atl[3],
color_med_atl[4]))
p2<-p
data_varpop=data.frame(PC=factor(paste("P",seq(1,10),sep=""),levels=paste("P",seq(1,10),sep="")),VAR=pca$varprop[1:10])
pp<-ggplot(data_varpop,aes(x=PC,y=VAR))+
geom_bar(stat='identity',fill="dodgerblue2",alpha=0.25)+
theme_classic()+
xlab("Principal Component")+
ylab("Variation explained (%)")
```
```{r}
subplot(ggplotly(p1)%>% layout(legend = list(orientation = "h", x = 0.2, y =-0.15)), ggplotly(p2)%>%hide_legend(), ggplotly(pp)%>%hide_legend(), titleX=T,titleY=T,margin=0.035,widths=c(0.375,0.425,0.2),which_layout=1) %>% partial_bundle()
```
### maf = 0.45
```{r}
pca=PCA_list$Prune_filtered$maf0.45[[1]]
data_pca=data.frame(INDIV=pca$sample.id,
PC1=pca$eigenvect[,1],
PC2=pca$eigenvect[,2],
PC3=pca$eigenvect[,3],
PC4=pca$eigenvect[,4],
LOCA=c(rep("Algarve",5),
rep("Bay of Biscay",5),
rep("Gulf of Lion",5),
rep("Costa Calida",5)))
color_med_atl=rev(brewer.pal(n=4,name="RdBu"))
p<-ggplot(data=data_pca,aes(x=PC1,y=PC2,label=INDIV))+
theme_minimal()+
theme(panel.grid=element_blank(),
panel.border=element_rect(fill="transparent"),
plot.title=element_text(hjust=0.5))+
geom_hline(yintercept=0,lty=2)+
geom_vline(xintercept=0,lty=2)+
geom_point(size=3,aes(col=LOCA))+
xlab(paste("PCA 1 (",round(pca$varprop[1]*100,2),"% )",sep=""))+
ylab(paste("PCA 2 (",round(pca$varprop[2]*100,2),"% )",sep=""))+
scale_colour_manual(name="Location",
values=c(color_med_atl[2],
color_med_atl[1],
color_med_atl[3],
color_med_atl[4]))
p1<-p
p<-ggplot(data=data_pca,aes(x=PC3,y=PC4,label=INDIV))+
theme_minimal()+
theme(panel.grid=element_blank(),
panel.border=element_rect(fill="transparent"),
plot.title=element_text(hjust=0.5))+
geom_hline(yintercept=0,lty=2)+
geom_vline(xintercept=0,lty=2)+
geom_point(size=3,aes(col=LOCA))+
xlab(paste("PCA 3 (",round(pca$varprop[3]*100,2),"% )",sep=""))+
ylab(paste("PCA 4 (",round(pca$varprop[4]*100,2),"% )",sep=""))+
scale_colour_manual(name="Location",
values=c(color_med_atl[2],
color_med_atl[1],
color_med_atl[3],
color_med_atl[4]))
p2<-p
data_varpop=data.frame(PC=factor(paste("P",seq(1,10),sep=""),levels=paste("P",seq(1,10),sep="")),VAR=pca$varprop[1:10])
pp<-ggplot(data_varpop,aes(x=PC,y=VAR))+
geom_bar(stat='identity',fill="dodgerblue2",alpha=0.25)+
theme_classic()+
xlab("Principal Component")+
ylab("Variation explained (%)")
```
```{r}
subplot(ggplotly(p1)%>% layout(legend = list(orientation = "h", x = 0.2, y =-0.15)), ggplotly(p2)%>%hide_legend(), ggplotly(pp)%>%hide_legend(), titleX=T,titleY=T,margin=0.035,widths=c(0.375,0.425,0.2),which_layout=1) %>% partial_bundle()
```
### maf = 0.50
```{r}
pca=PCA_list$Prune_filtered$maf0.5[[1]]
data_pca=data.frame(INDIV=pca$sample.id,
PC1=pca$eigenvect[,1],
PC2=pca$eigenvect[,2],
PC3=pca$eigenvect[,3],
PC4=pca$eigenvect[,4],
LOCA=c(rep("Algarve",5),
rep("Bay of Biscay",5),
rep("Gulf of Lion",5),
rep("Costa Calida",5)))
color_med_atl=rev(brewer.pal(n=4,name="RdBu"))
p<-ggplot(data=data_pca,aes(x=PC1,y=PC2,label=INDIV))+
theme_minimal()+
theme(panel.grid=element_blank(),
panel.border=element_rect(fill="transparent"),
plot.title=element_text(hjust=0.5))+
geom_hline(yintercept=0,lty=2)+
geom_vline(xintercept=0,lty=2)+
geom_point(size=3,aes(col=LOCA))+
xlab(paste("PCA 1 (",round(pca$varprop[1]*100,2),"% )",sep=""))+
ylab(paste("PCA 2 (",round(pca$varprop[2]*100,2),"% )",sep=""))+
scale_colour_manual(name="Location",
values=c(color_med_atl[2],
color_med_atl[1],
color_med_atl[3],
color_med_atl[4]))
p1<-p
p<-ggplot(data=data_pca,aes(x=PC3,y=PC4,label=INDIV))+
theme_minimal()+
theme(panel.grid=element_blank(),
panel.border=element_rect(fill="transparent"),
plot.title=element_text(hjust=0.5))+
geom_hline(yintercept=0,lty=2)+
geom_vline(xintercept=0,lty=2)+
geom_point(size=3,aes(col=LOCA))+
xlab(paste("PCA 3 (",round(pca$varprop[3]*100,2),"% )",sep=""))+
ylab(paste("PCA 4 (",round(pca$varprop[4]*100,2),"% )",sep=""))+
scale_colour_manual(name="Location",
values=c(color_med_atl[2],
color_med_atl[1],
color_med_atl[3],
color_med_atl[4]))
p2<-p
data_varpop=data.frame(PC=factor(paste("P",seq(1,10),sep=""),levels=paste("P",seq(1,10),sep="")),VAR=pca$varprop[1:10])
pp<-ggplot(data_varpop,aes(x=PC,y=VAR))+
geom_bar(stat='identity',fill="dodgerblue2",alpha=0.25)+
theme_classic()+
xlab("Principal Component")+
ylab("Variation explained (%)")
```
```{r}
subplot(ggplotly(p1)%>% layout(legend = list(orientation = "h", x = 0.2, y =-0.15)), ggplotly(p2)%>%hide_legend(), ggplotly(pp)%>%hide_legend(), titleX=T,titleY=T,margin=0.035,widths=c(0.375,0.425,0.2),which_layout=1) %>% partial_bundle()
```
Row {.tabset data-height=50}
-----------------------
<center>
<font size="6">**All unfiltered SNPS**</font>
</center>
Row {.tabset data-height=600}
-----------------------
### maf = 0
```{r}
pca=PCA_list$All_unfiltered$maf0[[1]]
data_pca=data.frame(INDIV=pca$sample.id,
PC1=pca$eigenvect[,1],
PC2=pca$eigenvect[,2],
PC3=pca$eigenvect[,3],
PC4=pca$eigenvect[,4],
LOCA=c(rep("Algarve",5),
rep("Bay of Biscay",5),
rep("Gulf of Lion",5),
rep("Costa Calida",5)))
color_med_atl=rev(brewer.pal(n=4,name="RdBu"))
p<-ggplot(data=data_pca,aes(x=PC1,y=PC2,label=INDIV))+
theme_minimal()+
theme(panel.grid=element_blank(),
panel.border=element_rect(fill="transparent"),
plot.title=element_text(hjust=0.5))+
geom_hline(yintercept=0,lty=2)+
geom_vline(xintercept=0,lty=2)+
geom_point(size=3,aes(col=LOCA))+
xlab(paste("PCA 1 (",round(pca$varprop[1]*100,2),"% )",sep=""))+
ylab(paste("PCA 2 (",round(pca$varprop[2]*100,2),"% )",sep=""))+
scale_colour_manual(name="Location",
values=c(color_med_atl[2],
color_med_atl[1],
color_med_atl[3],
color_med_atl[4]))
p1<-p
p<-ggplot(data=data_pca,aes(x=PC3,y=PC4,label=INDIV))+
theme_minimal()+
theme(panel.grid=element_blank(),
panel.border=element_rect(fill="transparent"),
plot.title=element_text(hjust=0.5))+
geom_hline(yintercept=0,lty=2)+
geom_vline(xintercept=0,lty=2)+
geom_point(size=3,aes(col=LOCA))+
xlab(paste("PCA 3 (",round(pca$varprop[3]*100,2),"% )",sep=""))+
ylab(paste("PCA 4 (",round(pca$varprop[4]*100,2),"% )",sep=""))+
scale_colour_manual(name="Location",
values=c(color_med_atl[2],
color_med_atl[1],
color_med_atl[3],
color_med_atl[4]))
p2<-p
data_varpop=data.frame(PC=factor(paste("P",seq(1,10),sep=""),levels=paste("P",seq(1,10),sep="")),VAR=pca$varprop[1:10])
pp<-ggplot(data_varpop,aes(x=PC,y=VAR))+
geom_bar(stat='identity',fill="dodgerblue2",alpha=0.25)+
theme_classic()+
xlab("Principal Component")+
ylab("Variation explained (%)")
```
```{r}
subplot(ggplotly(p1)%>% layout(legend = list(orientation = "h", x = 0.2, y =-0.15)), ggplotly(p2)%>%hide_legend(), ggplotly(pp)%>%hide_legend(), titleX=T,titleY=T,margin=0.035,widths=c(0.375,0.425,0.2),which_layout=1) %>% partial_bundle()
```
### maf = 0.05
```{r}
pca=PCA_list$All_unfiltered$maf0.05[[1]]
data_pca=data.frame(INDIV=pca$sample.id,
PC1=pca$eigenvect[,1],
PC2=pca$eigenvect[,2],
PC3=pca$eigenvect[,3],
PC4=pca$eigenvect[,4],
LOCA=c(rep("Algarve",5),
rep("Bay of Biscay",5),
rep("Gulf of Lion",5),
rep("Costa Calida",5)))
color_med_atl=rev(brewer.pal(n=4,name="RdBu"))
p<-ggplot(data=data_pca,aes(x=PC1,y=PC2,label=INDIV))+
theme_minimal()+
theme(panel.grid=element_blank(),
panel.border=element_rect(fill="transparent"),
plot.title=element_text(hjust=0.5))+
geom_hline(yintercept=0,lty=2)+
geom_vline(xintercept=0,lty=2)+
geom_point(size=3,aes(col=LOCA))+
xlab(paste("PCA 1 (",round(pca$varprop[1]*100,2),"% )",sep=""))+
ylab(paste("PCA 2 (",round(pca$varprop[2]*100,2),"% )",sep=""))+
scale_colour_manual(name="Location",
values=c(color_med_atl[2],
color_med_atl[1],
color_med_atl[3],
color_med_atl[4]))
p1<-p
p<-ggplot(data=data_pca,aes(x=PC3,y=PC4,label=INDIV))+
theme_minimal()+
theme(panel.grid=element_blank(),
panel.border=element_rect(fill="transparent"),
plot.title=element_text(hjust=0.5))+
geom_hline(yintercept=0,lty=2)+
geom_vline(xintercept=0,lty=2)+
geom_point(size=3,aes(col=LOCA))+
xlab(paste("PCA 3 (",round(pca$varprop[3]*100,2),"% )",sep=""))+
ylab(paste("PCA 4 (",round(pca$varprop[4]*100,2),"% )",sep=""))+
scale_colour_manual(name="Location",
values=c(color_med_atl[2],
color_med_atl[1],
color_med_atl[3],
color_med_atl[4]))
p2<-p
data_varpop=data.frame(PC=factor(paste("P",seq(1,10),sep=""),levels=paste("P",seq(1,10),sep="")),VAR=pca$varprop[1:10])
pp<-ggplot(data_varpop,aes(x=PC,y=VAR))+
geom_bar(stat='identity',fill="dodgerblue2",alpha=0.25)+
theme_classic()+
xlab("Principal Component")+
ylab("Variation explained (%)")
```
```{r}
subplot(ggplotly(p1)%>% layout(legend = list(orientation = "h", x = 0.2, y =-0.15)), ggplotly(p2)%>%hide_legend(), ggplotly(pp)%>%hide_legend(), titleX=T,titleY=T,margin=0.035,widths=c(0.375,0.425,0.2),which_layout=1) %>% partial_bundle()
```
### maf = 0.1
```{r}
pca=PCA_list$All_unfiltered$maf0.1[[1]]
data_pca=data.frame(INDIV=pca$sample.id,
PC1=pca$eigenvect[,1],
PC2=pca$eigenvect[,2],
PC3=pca$eigenvect[,3],
PC4=pca$eigenvect[,4],
LOCA=c(rep("Algarve",5),
rep("Bay of Biscay",5),
rep("Gulf of Lion",5),
rep("Costa Calida",5)))
color_med_atl=rev(brewer.pal(n=4,name="RdBu"))
p<-ggplot(data=data_pca,aes(x=PC1,y=PC2,label=INDIV))+
theme_minimal()+
theme(panel.grid=element_blank(),
panel.border=element_rect(fill="transparent"),
plot.title=element_text(hjust=0.5))+
geom_hline(yintercept=0,lty=2)+
geom_vline(xintercept=0,lty=2)+
geom_point(size=3,aes(col=LOCA))+
xlab(paste("PCA 1 (",round(pca$varprop[1]*100,2),"% )",sep=""))+
ylab(paste("PCA 2 (",round(pca$varprop[2]*100,2),"% )",sep=""))+
scale_colour_manual(name="Location",
values=c(color_med_atl[2],
color_med_atl[1],
color_med_atl[3],
color_med_atl[4]))
p1<-p
p<-ggplot(data=data_pca,aes(x=PC3,y=PC4,label=INDIV))+
theme_minimal()+
theme(panel.grid=element_blank(),
panel.border=element_rect(fill="transparent"),
plot.title=element_text(hjust=0.5))+
geom_hline(yintercept=0,lty=2)+
geom_vline(xintercept=0,lty=2)+
geom_point(size=3,aes(col=LOCA))+
xlab(paste("PCA 3 (",round(pca$varprop[3]*100,2),"% )",sep=""))+
ylab(paste("PCA 4 (",round(pca$varprop[4]*100,2),"% )",sep=""))+
scale_colour_manual(name="Location",
values=c(color_med_atl[2],
color_med_atl[1],
color_med_atl[3],
color_med_atl[4]))
p2<-p
data_varpop=data.frame(PC=factor(paste("P",seq(1,10),sep=""),levels=paste("P",seq(1,10),sep="")),VAR=pca$varprop[1:10])
pp<-ggplot(data_varpop,aes(x=PC,y=VAR))+
geom_bar(stat='identity',fill="dodgerblue2",alpha=0.25)+
theme_classic()+
xlab("Principal Component")+
ylab("Variation explained (%)")
```
```{r}
subplot(ggplotly(p1)%>% layout(legend = list(orientation = "h", x = 0.2, y =-0.15)), ggplotly(p2)%>%hide_legend(), ggplotly(pp)%>%hide_legend(), titleX=T,titleY=T,margin=0.035,widths=c(0.375,0.425,0.2),which_layout=1) %>% partial_bundle()
```
### maf = 0.15
```{r}
pca=PCA_list$All_unfiltered$maf0.15[[1]]
data_pca=data.frame(INDIV=pca$sample.id,
PC1=pca$eigenvect[,1],
PC2=pca$eigenvect[,2],
PC3=pca$eigenvect[,3],
PC4=pca$eigenvect[,4],
LOCA=c(rep("Algarve",5),
rep("Bay of Biscay",5),
rep("Gulf of Lion",5),
rep("Costa Calida",5)))
color_med_atl=rev(brewer.pal(n=4,name="RdBu"))
p<-ggplot(data=data_pca,aes(x=PC1,y=PC2,label=INDIV))+
theme_minimal()+
theme(panel.grid=element_blank(),
panel.border=element_rect(fill="transparent"),
plot.title=element_text(hjust=0.5))+
geom_hline(yintercept=0,lty=2)+
geom_vline(xintercept=0,lty=2)+
geom_point(size=3,aes(col=LOCA))+
xlab(paste("PCA 1 (",round(pca$varprop[1]*100,2),"% )",sep=""))+
ylab(paste("PCA 2 (",round(pca$varprop[2]*100,2),"% )",sep=""))+
scale_colour_manual(name="Location",
values=c(color_med_atl[2],
color_med_atl[1],
color_med_atl[3],
color_med_atl[4]))
p1<-p
p<-ggplot(data=data_pca,aes(x=PC3,y=PC4,label=INDIV))+
theme_minimal()+
theme(panel.grid=element_blank(),
panel.border=element_rect(fill="transparent"),
plot.title=element_text(hjust=0.5))+
geom_hline(yintercept=0,lty=2)+
geom_vline(xintercept=0,lty=2)+
geom_point(size=3,aes(col=LOCA))+
xlab(paste("PCA 3 (",round(pca$varprop[3]*100,2),"% )",sep=""))+
ylab(paste("PCA 4 (",round(pca$varprop[4]*100,2),"% )",sep=""))+
scale_colour_manual(name="Location",
values=c(color_med_atl[2],
color_med_atl[1],
color_med_atl[3],
color_med_atl[4]))
p2<-p
data_varpop=data.frame(PC=factor(paste("P",seq(1,10),sep=""),levels=paste("P",seq(1,10),sep="")),VAR=pca$varprop[1:10])
pp<-ggplot(data_varpop,aes(x=PC,y=VAR))+
geom_bar(stat='identity',fill="dodgerblue2",alpha=0.25)+
theme_classic()+
xlab("Principal Component")+
ylab("Variation explained (%)")
```
```{r}
subplot(ggplotly(p1)%>% layout(legend = list(orientation = "h", x = 0.2, y =-0.15)), ggplotly(p2)%>%hide_legend(), ggplotly(pp)%>%hide_legend(), titleX=T,titleY=T,margin=0.035,widths=c(0.375,0.425,0.2),which_layout=1) %>% partial_bundle()
```
### maf = 0.20
```{r}
pca=PCA_list$All_unfiltered$maf0.2[[1]]
data_pca=data.frame(INDIV=pca$sample.id,
PC1=pca$eigenvect[,1],
PC2=pca$eigenvect[,2],
PC3=pca$eigenvect[,3],
PC4=pca$eigenvect[,4],
LOCA=c(rep("Algarve",5),
rep("Bay of Biscay",5),
rep("Gulf of Lion",5),
rep("Costa Calida",5)))
color_med_atl=rev(brewer.pal(n=4,name="RdBu"))
p<-ggplot(data=data_pca,aes(x=PC1,y=PC2,label=INDIV))+
theme_minimal()+
theme(panel.grid=element_blank(),
panel.border=element_rect(fill="transparent"),
plot.title=element_text(hjust=0.5))+
geom_hline(yintercept=0,lty=2)+
geom_vline(xintercept=0,lty=2)+
geom_point(size=3,aes(col=LOCA))+
xlab(paste("PCA 1 (",round(pca$varprop[1]*100,2),"% )",sep=""))+
ylab(paste("PCA 2 (",round(pca$varprop[2]*100,2),"% )",sep=""))+
scale_colour_manual(name="Location",
values=c(color_med_atl[2],
color_med_atl[1],
color_med_atl[3],
color_med_atl[4]))
p1<-p
p<-ggplot(data=data_pca,aes(x=PC3,y=PC4,label=INDIV))+
theme_minimal()+
theme(panel.grid=element_blank(),
panel.border=element_rect(fill="transparent"),
plot.title=element_text(hjust=0.5))+
geom_hline(yintercept=0,lty=2)+
geom_vline(xintercept=0,lty=2)+
geom_point(size=3,aes(col=LOCA))+
xlab(paste("PCA 3 (",round(pca$varprop[3]*100,2),"% )",sep=""))+
ylab(paste("PCA 4 (",round(pca$varprop[4]*100,2),"% )",sep=""))+
scale_colour_manual(name="Location",
values=c(color_med_atl[2],
color_med_atl[1],
color_med_atl[3],
color_med_atl[4]))
p2<-p
data_varpop=data.frame(PC=factor(paste("P",seq(1,10),sep=""),levels=paste("P",seq(1,10),sep="")),VAR=pca$varprop[1:10])
pp<-ggplot(data_varpop,aes(x=PC,y=VAR))+
geom_bar(stat='identity',fill="dodgerblue2",alpha=0.25)+
theme_classic()+
xlab("Principal Component")+
ylab("Variation explained (%)")
```
```{r}
subplot(ggplotly(p1)%>% layout(legend = list(orientation = "h", x = 0.2, y =-0.15)), ggplotly(p2)%>%hide_legend(), ggplotly(pp)%>%hide_legend(), titleX=T,titleY=T,margin=0.035,widths=c(0.375,0.425,0.2),which_layout=1) %>% partial_bundle()
```
### maf = 0.25
```{r}
pca=PCA_list$All_unfiltered$maf0.25[[1]]
data_pca=data.frame(INDIV=pca$sample.id,
PC1=pca$eigenvect[,1],
PC2=pca$eigenvect[,2],
PC3=pca$eigenvect[,3],
PC4=pca$eigenvect[,4],
LOCA=c(rep("Algarve",5),
rep("Bay of Biscay",5),
rep("Gulf of Lion",5),
rep("Costa Calida",5)))
color_med_atl=rev(brewer.pal(n=4,name="RdBu"))
p<-ggplot(data=data_pca,aes(x=PC1,y=PC2,label=INDIV))+
theme_minimal()+
theme(panel.grid=element_blank(),
panel.border=element_rect(fill="transparent"),
plot.title=element_text(hjust=0.5))+
geom_hline(yintercept=0,lty=2)+
geom_vline(xintercept=0,lty=2)+
geom_point(size=3,aes(col=LOCA))+
xlab(paste("PCA 1 (",round(pca$varprop[1]*100,2),"% )",sep=""))+
ylab(paste("PCA 2 (",round(pca$varprop[2]*100,2),"% )",sep=""))+
scale_colour_manual(name="Location",
values=c(color_med_atl[2],
color_med_atl[1],
color_med_atl[3],
color_med_atl[4]))
p1<-p
p<-ggplot(data=data_pca,aes(x=PC3,y=PC4,label=INDIV))+
theme_minimal()+
theme(panel.grid=element_blank(),
panel.border=element_rect(fill="transparent"),
plot.title=element_text(hjust=0.5))+
geom_hline(yintercept=0,lty=2)+
geom_vline(xintercept=0,lty=2)+
geom_point(size=3,aes(col=LOCA))+
xlab(paste("PCA 3 (",round(pca$varprop[3]*100,2),"% )",sep=""))+
ylab(paste("PCA 4 (",round(pca$varprop[4]*100,2),"% )",sep=""))+
scale_colour_manual(name="Location",
values=c(color_med_atl[2],
color_med_atl[1],
color_med_atl[3],
color_med_atl[4]))
p2<-p
data_varpop=data.frame(PC=factor(paste("P",seq(1,10),sep=""),levels=paste("P",seq(1,10),sep="")),VAR=pca$varprop[1:10])
pp<-ggplot(data_varpop,aes(x=PC,y=VAR))+
geom_bar(stat='identity',fill="dodgerblue2",alpha=0.25)+
theme_classic()+
xlab("Principal Component")+
ylab("Variation explained (%)")
```
```{r}
subplot(ggplotly(p1)%>% layout(legend = list(orientation = "h", x = 0.2, y =-0.15)), ggplotly(p2)%>%hide_legend(), ggplotly(pp)%>%hide_legend(), titleX=T,titleY=T,margin=0.035,widths=c(0.375,0.425,0.2),which_layout=1) %>% partial_bundle()
```
### maf = 0.30
```{r}
pca=PCA_list$All_unfiltered$maf0.3[[1]]
data_pca=data.frame(INDIV=pca$sample.id,
PC1=pca$eigenvect[,1],
PC2=pca$eigenvect[,2],
PC3=pca$eigenvect[,3],
PC4=pca$eigenvect[,4],
LOCA=c(rep("Algarve",5),
rep("Bay of Biscay",5),
rep("Gulf of Lion",5),
rep("Costa Calida",5)))
color_med_atl=rev(brewer.pal(n=4,name="RdBu"))
p<-ggplot(data=data_pca,aes(x=PC1,y=PC2,label=INDIV))+
theme_minimal()+
theme(panel.grid=element_blank(),
panel.border=element_rect(fill="transparent"),
plot.title=element_text(hjust=0.5))+
geom_hline(yintercept=0,lty=2)+
geom_vline(xintercept=0,lty=2)+
geom_point(size=3,aes(col=LOCA))+
xlab(paste("PCA 1 (",round(pca$varprop[1]*100,2),"% )",sep=""))+
ylab(paste("PCA 2 (",round(pca$varprop[2]*100,2),"% )",sep=""))+
scale_colour_manual(name="Location",
values=c(color_med_atl[2],
color_med_atl[1],
color_med_atl[3],
color_med_atl[4]))
p1<-p
p<-ggplot(data=data_pca,aes(x=PC3,y=PC4,label=INDIV))+
theme_minimal()+
theme(panel.grid=element_blank(),
panel.border=element_rect(fill="transparent"),
plot.title=element_text(hjust=0.5))+
geom_hline(yintercept=0,lty=2)+
geom_vline(xintercept=0,lty=2)+
geom_point(size=3,aes(col=LOCA))+
xlab(paste("PCA 3 (",round(pca$varprop[3]*100,2),"% )",sep=""))+
ylab(paste("PCA 4 (",round(pca$varprop[4]*100,2),"% )",sep=""))+
scale_colour_manual(name="Location",
values=c(color_med_atl[2],
color_med_atl[1],
color_med_atl[3],
color_med_atl[4]))
p2<-p
data_varpop=data.frame(PC=factor(paste("P",seq(1,10),sep=""),levels=paste("P",seq(1,10),sep="")),VAR=pca$varprop[1:10])
pp<-ggplot(data_varpop,aes(x=PC,y=VAR))+
geom_bar(stat='identity',fill="dodgerblue2",alpha=0.25)+
theme_classic()+
xlab("Principal Component")+
ylab("Variation explained (%)")
```
```{r}
subplot(ggplotly(p1)%>% layout(legend = list(orientation = "h", x = 0.2, y =-0.15)), ggplotly(p2)%>%hide_legend(), ggplotly(pp)%>%hide_legend(), titleX=T,titleY=T,margin=0.035,widths=c(0.375,0.425,0.2),which_layout=1) %>% partial_bundle()
```
### maf = 0.35
```{r}
pca=PCA_list$All_unfiltered$maf0.35[[1]]
data_pca=data.frame(INDIV=pca$sample.id,
PC1=pca$eigenvect[,1],
PC2=pca$eigenvect[,2],
PC3=pca$eigenvect[,3],
PC4=pca$eigenvect[,4],
LOCA=c(rep("Algarve",5),
rep("Bay of Biscay",5),
rep("Gulf of Lion",5),
rep("Costa Calida",5)))
color_med_atl=rev(brewer.pal(n=4,name="RdBu"))
p<-ggplot(data=data_pca,aes(x=PC1,y=PC2,label=INDIV))+
theme_minimal()+
theme(panel.grid=element_blank(),
panel.border=element_rect(fill="transparent"),
plot.title=element_text(hjust=0.5))+
geom_hline(yintercept=0,lty=2)+
geom_vline(xintercept=0,lty=2)+
geom_point(size=3,aes(col=LOCA))+
xlab(paste("PCA 1 (",round(pca$varprop[1]*100,2),"% )",sep=""))+
ylab(paste("PCA 2 (",round(pca$varprop[2]*100,2),"% )",sep=""))+
scale_colour_manual(name="Location",
values=c(color_med_atl[2],
color_med_atl[1],
color_med_atl[3],
color_med_atl[4]))
p1<-p
p<-ggplot(data=data_pca,aes(x=PC3,y=PC4,label=INDIV))+
theme_minimal()+
theme(panel.grid=element_blank(),
panel.border=element_rect(fill="transparent"),
plot.title=element_text(hjust=0.5))+
geom_hline(yintercept=0,lty=2)+
geom_vline(xintercept=0,lty=2)+
geom_point(size=3,aes(col=LOCA))+
xlab(paste("PCA 3 (",round(pca$varprop[3]*100,2),"% )",sep=""))+
ylab(paste("PCA 4 (",round(pca$varprop[4]*100,2),"% )",sep=""))+
scale_colour_manual(name="Location",
values=c(color_med_atl[2],
color_med_atl[1],
color_med_atl[3],
color_med_atl[4]))
p2<-p
data_varpop=data.frame(PC=factor(paste("P",seq(1,10),sep=""),levels=paste("P",seq(1,10),sep="")),VAR=pca$varprop[1:10])
pp<-ggplot(data_varpop,aes(x=PC,y=VAR))+
geom_bar(stat='identity',fill="dodgerblue2",alpha=0.25)+
theme_classic()+
xlab("Principal Component")+
ylab("Variation explained (%)")
```
```{r}
subplot(ggplotly(p1)%>% layout(legend = list(orientation = "h", x = 0.2, y =-0.15)), ggplotly(p2)%>%hide_legend(), ggplotly(pp)%>%hide_legend(), titleX=T,titleY=T,margin=0.035,widths=c(0.375,0.425,0.2),which_layout=1) %>% partial_bundle()
```
### maf = 0.40
```{r}
pca=PCA_list$All_unfiltered$maf0.4[[1]]
data_pca=data.frame(INDIV=pca$sample.id,
PC1=pca$eigenvect[,1],
PC2=pca$eigenvect[,2],
PC3=pca$eigenvect[,3],
PC4=pca$eigenvect[,4],
LOCA=c(rep("Algarve",5),
rep("Bay of Biscay",5),
rep("Gulf of Lion",5),
rep("Costa Calida",5)))
color_med_atl=rev(brewer.pal(n=4,name="RdBu"))
p<-ggplot(data=data_pca,aes(x=PC1,y=PC2,label=INDIV))+
theme_minimal()+
theme(panel.grid=element_blank(),
panel.border=element_rect(fill="transparent"),
plot.title=element_text(hjust=0.5))+
geom_hline(yintercept=0,lty=2)+
geom_vline(xintercept=0,lty=2)+
geom_point(size=3,aes(col=LOCA))+
xlab(paste("PCA 1 (",round(pca$varprop[1]*100,2),"% )",sep=""))+
ylab(paste("PCA 2 (",round(pca$varprop[2]*100,2),"% )",sep=""))+
scale_colour_manual(name="Location",
values=c(color_med_atl[2],
color_med_atl[1],
color_med_atl[3],
color_med_atl[4]))
p1<-p
p<-ggplot(data=data_pca,aes(x=PC3,y=PC4,label=INDIV))+
theme_minimal()+
theme(panel.grid=element_blank(),
panel.border=element_rect(fill="transparent"),
plot.title=element_text(hjust=0.5))+
geom_hline(yintercept=0,lty=2)+
geom_vline(xintercept=0,lty=2)+
geom_point(size=3,aes(col=LOCA))+
xlab(paste("PCA 3 (",round(pca$varprop[3]*100,2),"% )",sep=""))+
ylab(paste("PCA 4 (",round(pca$varprop[4]*100,2),"% )",sep=""))+
scale_colour_manual(name="Location",
values=c(color_med_atl[2],
color_med_atl[1],
color_med_atl[3],
color_med_atl[4]))
p2<-p
data_varpop=data.frame(PC=factor(paste("P",seq(1,10),sep=""),levels=paste("P",seq(1,10),sep="")),VAR=pca$varprop[1:10])
pp<-ggplot(data_varpop,aes(x=PC,y=VAR))+
geom_bar(stat='identity',fill="dodgerblue2",alpha=0.25)+
theme_classic()+
xlab("Principal Component")+
ylab("Variation explained (%)")
```
```{r}
subplot(ggplotly(p1)%>% layout(legend = list(orientation = "h", x = 0.2, y =-0.15)), ggplotly(p2)%>%hide_legend(), ggplotly(pp)%>%hide_legend(), titleX=T,titleY=T,margin=0.035,widths=c(0.375,0.425,0.2),which_layout=1) %>% partial_bundle()
```
### maf = 0.45
```{r}
pca=PCA_list$All_unfiltered$maf0.45[[1]]
data_pca=data.frame(INDIV=pca$sample.id,
PC1=pca$eigenvect[,1],
PC2=pca$eigenvect[,2],
PC3=pca$eigenvect[,3],
PC4=pca$eigenvect[,4],
LOCA=c(rep("Algarve",5),
rep("Bay of Biscay",5),
rep("Gulf of Lion",5),
rep("Costa Calida",5)))
color_med_atl=rev(brewer.pal(n=4,name="RdBu"))
p<-ggplot(data=data_pca,aes(x=PC1,y=PC2,label=INDIV))+
theme_minimal()+
theme(panel.grid=element_blank(),
panel.border=element_rect(fill="transparent"),
plot.title=element_text(hjust=0.5))+
geom_hline(yintercept=0,lty=2)+
geom_vline(xintercept=0,lty=2)+
geom_point(size=3,aes(col=LOCA))+
xlab(paste("PCA 1 (",round(pca$varprop[1]*100,2),"% )",sep=""))+
ylab(paste("PCA 2 (",round(pca$varprop[2]*100,2),"% )",sep=""))+
scale_colour_manual(name="Location",
values=c(color_med_atl[2],
color_med_atl[1],
color_med_atl[3],
color_med_atl[4]))
p1<-p
p<-ggplot(data=data_pca,aes(x=PC3,y=PC4,label=INDIV))+
theme_minimal()+
theme(panel.grid=element_blank(),
panel.border=element_rect(fill="transparent"),
plot.title=element_text(hjust=0.5))+
geom_hline(yintercept=0,lty=2)+
geom_vline(xintercept=0,lty=2)+
geom_point(size=3,aes(col=LOCA))+
xlab(paste("PCA 3 (",round(pca$varprop[3]*100,2),"% )",sep=""))+
ylab(paste("PCA 4 (",round(pca$varprop[4]*100,2),"% )",sep=""))+
scale_colour_manual(name="Location",
values=c(color_med_atl[2],
color_med_atl[1],
color_med_atl[3],
color_med_atl[4]))
p2<-p
data_varpop=data.frame(PC=factor(paste("P",seq(1,10),sep=""),levels=paste("P",seq(1,10),sep="")),VAR=pca$varprop[1:10])
pp<-ggplot(data_varpop,aes(x=PC,y=VAR))+
geom_bar(stat='identity',fill="dodgerblue2",alpha=0.25)+
theme_classic()+
xlab("Principal Component")+
ylab("Variation explained (%)")
```
```{r}
subplot(ggplotly(p1)%>% layout(legend = list(orientation = "h", x = 0.2, y =-0.15)), ggplotly(p2)%>%hide_legend(), ggplotly(pp)%>%hide_legend(), titleX=T,titleY=T,margin=0.035,widths=c(0.375,0.425,0.2),which_layout=1) %>% partial_bundle()
```
### maf = 0.50
```{r}
pca=PCA_list$All_unfiltered$maf0.5[[1]]
data_pca=data.frame(INDIV=pca$sample.id,
PC1=pca$eigenvect[,1],
PC2=pca$eigenvect[,2],
PC3=pca$eigenvect[,3],
PC4=pca$eigenvect[,4],
LOCA=c(rep("Algarve",5),
rep("Bay of Biscay",5),
rep("Gulf of Lion",5),
rep("Costa Calida",5)))
color_med_atl=rev(brewer.pal(n=4,name="RdBu"))
p<-ggplot(data=data_pca,aes(x=PC1,y=PC2,label=INDIV))+
theme_minimal()+
theme(panel.grid=element_blank(),
panel.border=element_rect(fill="transparent"),
plot.title=element_text(hjust=0.5))+
geom_hline(yintercept=0,lty=2)+
geom_vline(xintercept=0,lty=2)+
geom_point(size=3,aes(col=LOCA))+
xlab(paste("PCA 1 (",round(pca$varprop[1]*100,2),"% )",sep=""))+
ylab(paste("PCA 2 (",round(pca$varprop[2]*100,2),"% )",sep=""))+
scale_colour_manual(name="Location",
values=c(color_med_atl[2],
color_med_atl[1],
color_med_atl[3],
color_med_atl[4]))
p1<-p
p<-ggplot(data=data_pca,aes(x=PC3,y=PC4,label=INDIV))+
theme_minimal()+
theme(panel.grid=element_blank(),
panel.border=element_rect(fill="transparent"),
plot.title=element_text(hjust=0.5))+
geom_hline(yintercept=0,lty=2)+
geom_vline(xintercept=0,lty=2)+
geom_point(size=3,aes(col=LOCA))+
xlab(paste("PCA 3 (",round(pca$varprop[3]*100,2),"% )",sep=""))+
ylab(paste("PCA 4 (",round(pca$varprop[4]*100,2),"% )",sep=""))+
scale_colour_manual(name="Location",
values=c(color_med_atl[2],
color_med_atl[1],
color_med_atl[3],
color_med_atl[4]))
p2<-p
data_varpop=data.frame(PC=factor(paste("P",seq(1,10),sep=""),levels=paste("P",seq(1,10),sep="")),VAR=pca$varprop[1:10])
pp<-ggplot(data_varpop,aes(x=PC,y=VAR))+
geom_bar(stat='identity',fill="dodgerblue2",alpha=0.25)+
theme_classic()+
xlab("Principal Component")+
ylab("Variation explained (%)")
```
```{r}
subplot(ggplotly(p1)%>% layout(legend = list(orientation = "h", x = 0.2, y =-0.15)), ggplotly(p2)%>%hide_legend(), ggplotly(pp)%>%hide_legend(), titleX=T,titleY=T,margin=0.035,widths=c(0.375,0.425,0.2),which_layout=1) %>% partial_bundle()
```
Row {.tabset data-height=50}
-----------------------
<center>
<font size="6">**Pruned unfiltered SNPS**</font>
</center>
Row {.tabset data-height=600}
-----------------------
### maf = 0
```{r}
pca=PCA_list$Prune_unfiltered$maf0[[1]]
data_pca=data.frame(INDIV=pca$sample.id,
PC1=pca$eigenvect[,1],
PC2=pca$eigenvect[,2],
PC3=pca$eigenvect[,3],
PC4=pca$eigenvect[,4],
LOCA=c(rep("Algarve",5),
rep("Bay of Biscay",5),
rep("Gulf of Lion",5),
rep("Costa Calida",5)))
color_med_atl=rev(brewer.pal(n=4,name="RdBu"))
p<-ggplot(data=data_pca,aes(x=PC1,y=PC2,label=INDIV))+
theme_minimal()+
theme(panel.grid=element_blank(),
panel.border=element_rect(fill="transparent"),
plot.title=element_text(hjust=0.5))+
geom_hline(yintercept=0,lty=2)+
geom_vline(xintercept=0,lty=2)+
geom_point(size=3,aes(col=LOCA))+
xlab(paste("PCA 1 (",round(pca$varprop[1]*100,2),"% )",sep=""))+
ylab(paste("PCA 2 (",round(pca$varprop[2]*100,2),"% )",sep=""))+
scale_colour_manual(name="Location",
values=c(color_med_atl[2],
color_med_atl[1],
color_med_atl[3],
color_med_atl[4]))
p1<-p
p<-ggplot(data=data_pca,aes(x=PC3,y=PC4,label=INDIV))+
theme_minimal()+
theme(panel.grid=element_blank(),
panel.border=element_rect(fill="transparent"),
plot.title=element_text(hjust=0.5))+
geom_hline(yintercept=0,lty=2)+
geom_vline(xintercept=0,lty=2)+
geom_point(size=3,aes(col=LOCA))+
xlab(paste("PCA 3 (",round(pca$varprop[3]*100,2),"% )",sep=""))+
ylab(paste("PCA 4 (",round(pca$varprop[4]*100,2),"% )",sep=""))+
scale_colour_manual(name="Location",
values=c(color_med_atl[2],
color_med_atl[1],
color_med_atl[3],
color_med_atl[4]))
p2<-p
data_varpop=data.frame(PC=factor(paste("P",seq(1,10),sep=""),levels=paste("P",seq(1,10),sep="")),VAR=pca$varprop[1:10])
pp<-ggplot(data_varpop,aes(x=PC,y=VAR))+
geom_bar(stat='identity',fill="dodgerblue2",alpha=0.25)+
theme_classic()+
xlab("Principal Component")+
ylab("Variation explained (%)")
```
```{r}
subplot(ggplotly(p1)%>% layout(legend = list(orientation = "h", x = 0.2, y =-0.15)), ggplotly(p2)%>%hide_legend(), ggplotly(pp)%>%hide_legend(), titleX=T,titleY=T,margin=0.035,widths=c(0.375,0.425,0.2),which_layout=1) %>% partial_bundle()
```
### maf = 0.05
```{r}
pca=PCA_list$Prune_unfiltered$maf0.05[[1]]
data_pca=data.frame(INDIV=pca$sample.id,
PC1=pca$eigenvect[,1],
PC2=pca$eigenvect[,2],
PC3=pca$eigenvect[,3],
PC4=pca$eigenvect[,4],
LOCA=c(rep("Algarve",5),
rep("Bay of Biscay",5),
rep("Gulf of Lion",5),
rep("Costa Calida",5)))
color_med_atl=rev(brewer.pal(n=4,name="RdBu"))
p<-ggplot(data=data_pca,aes(x=PC1,y=PC2,label=INDIV))+
theme_minimal()+
theme(panel.grid=element_blank(),
panel.border=element_rect(fill="transparent"),
plot.title=element_text(hjust=0.5))+
geom_hline(yintercept=0,lty=2)+
geom_vline(xintercept=0,lty=2)+
geom_point(size=3,aes(col=LOCA))+
xlab(paste("PCA 1 (",round(pca$varprop[1]*100,2),"% )",sep=""))+
ylab(paste("PCA 2 (",round(pca$varprop[2]*100,2),"% )",sep=""))+
scale_colour_manual(name="Location",
values=c(color_med_atl[2],
color_med_atl[1],
color_med_atl[3],
color_med_atl[4]))
p1<-p
p<-ggplot(data=data_pca,aes(x=PC3,y=PC4,label=INDIV))+
theme_minimal()+
theme(panel.grid=element_blank(),
panel.border=element_rect(fill="transparent"),
plot.title=element_text(hjust=0.5))+
geom_hline(yintercept=0,lty=2)+
geom_vline(xintercept=0,lty=2)+
geom_point(size=3,aes(col=LOCA))+
xlab(paste("PCA 3 (",round(pca$varprop[3]*100,2),"% )",sep=""))+
ylab(paste("PCA 4 (",round(pca$varprop[4]*100,2),"% )",sep=""))+
scale_colour_manual(name="Location",
values=c(color_med_atl[2],
color_med_atl[1],
color_med_atl[3],
color_med_atl[4]))
p2<-p
data_varpop=data.frame(PC=factor(paste("P",seq(1,10),sep=""),levels=paste("P",seq(1,10),sep="")),VAR=pca$varprop[1:10])
pp<-ggplot(data_varpop,aes(x=PC,y=VAR))+
geom_bar(stat='identity',fill="dodgerblue2",alpha=0.25)+
theme_classic()+
xlab("Principal Component")+
ylab("Variation explained (%)")
```
```{r}
subplot(ggplotly(p1)%>% layout(legend = list(orientation = "h", x = 0.2, y =-0.15)), ggplotly(p2)%>%hide_legend(), ggplotly(pp)%>%hide_legend(), titleX=T,titleY=T,margin=0.035,widths=c(0.375,0.425,0.2),which_layout=1) %>% partial_bundle()
```
### maf = 0.1
```{r}
pca=PCA_list$Prune_unfiltered$maf0.1[[1]]
data_pca=data.frame(INDIV=pca$sample.id,
PC1=pca$eigenvect[,1],
PC2=pca$eigenvect[,2],
PC3=pca$eigenvect[,3],
PC4=pca$eigenvect[,4],
LOCA=c(rep("Algarve",5),
rep("Bay of Biscay",5),
rep("Gulf of Lion",5),
rep("Costa Calida",5)))
color_med_atl=rev(brewer.pal(n=4,name="RdBu"))
p<-ggplot(data=data_pca,aes(x=PC1,y=PC2,label=INDIV))+
theme_minimal()+
theme(panel.grid=element_blank(),
panel.border=element_rect(fill="transparent"),
plot.title=element_text(hjust=0.5))+
geom_hline(yintercept=0,lty=2)+
geom_vline(xintercept=0,lty=2)+
geom_point(size=3,aes(col=LOCA))+
xlab(paste("PCA 1 (",round(pca$varprop[1]*100,2),"% )",sep=""))+
ylab(paste("PCA 2 (",round(pca$varprop[2]*100,2),"% )",sep=""))+
scale_colour_manual(name="Location",
values=c(color_med_atl[2],
color_med_atl[1],
color_med_atl[3],
color_med_atl[4]))
p1<-p
p<-ggplot(data=data_pca,aes(x=PC3,y=PC4,label=INDIV))+
theme_minimal()+
theme(panel.grid=element_blank(),
panel.border=element_rect(fill="transparent"),
plot.title=element_text(hjust=0.5))+
geom_hline(yintercept=0,lty=2)+
geom_vline(xintercept=0,lty=2)+
geom_point(size=3,aes(col=LOCA))+
xlab(paste("PCA 3 (",round(pca$varprop[3]*100,2),"% )",sep=""))+
ylab(paste("PCA 4 (",round(pca$varprop[4]*100,2),"% )",sep=""))+
scale_colour_manual(name="Location",
values=c(color_med_atl[2],
color_med_atl[1],
color_med_atl[3],
color_med_atl[4]))
p2<-p
data_varpop=data.frame(PC=factor(paste("P",seq(1,10),sep=""),levels=paste("P",seq(1,10),sep="")),VAR=pca$varprop[1:10])
pp<-ggplot(data_varpop,aes(x=PC,y=VAR))+
geom_bar(stat='identity',fill="dodgerblue2",alpha=0.25)+
theme_classic()+
xlab("Principal Component")+
ylab("Variation explained (%)")
```
```{r}
subplot(ggplotly(p1)%>% layout(legend = list(orientation = "h", x = 0.2, y =-0.15)), ggplotly(p2)%>%hide_legend(), ggplotly(pp)%>%hide_legend(), titleX=T,titleY=T,margin=0.035,widths=c(0.375,0.425,0.2),which_layout=1) %>% partial_bundle()
```
### maf = 0.15
```{r}
pca=PCA_list$Prune_unfiltered$maf0.15[[1]]
data_pca=data.frame(INDIV=pca$sample.id,
PC1=pca$eigenvect[,1],
PC2=pca$eigenvect[,2],
PC3=pca$eigenvect[,3],
PC4=pca$eigenvect[,4],
LOCA=c(rep("Algarve",5),
rep("Bay of Biscay",5),
rep("Gulf of Lion",5),
rep("Costa Calida",5)))
color_med_atl=rev(brewer.pal(n=4,name="RdBu"))
p<-ggplot(data=data_pca,aes(x=PC1,y=PC2,label=INDIV))+
theme_minimal()+
theme(panel.grid=element_blank(),
panel.border=element_rect(fill="transparent"),
plot.title=element_text(hjust=0.5))+
geom_hline(yintercept=0,lty=2)+
geom_vline(xintercept=0,lty=2)+
geom_point(size=3,aes(col=LOCA))+
xlab(paste("PCA 1 (",round(pca$varprop[1]*100,2),"% )",sep=""))+
ylab(paste("PCA 2 (",round(pca$varprop[2]*100,2),"% )",sep=""))+
scale_colour_manual(name="Location",
values=c(color_med_atl[2],
color_med_atl[1],
color_med_atl[3],
color_med_atl[4]))
p1<-p
p<-ggplot(data=data_pca,aes(x=PC3,y=PC4,label=INDIV))+
theme_minimal()+
theme(panel.grid=element_blank(),
panel.border=element_rect(fill="transparent"),
plot.title=element_text(hjust=0.5))+
geom_hline(yintercept=0,lty=2)+
geom_vline(xintercept=0,lty=2)+
geom_point(size=3,aes(col=LOCA))+
xlab(paste("PCA 3 (",round(pca$varprop[3]*100,2),"% )",sep=""))+
ylab(paste("PCA 4 (",round(pca$varprop[4]*100,2),"% )",sep=""))+
scale_colour_manual(name="Location",
values=c(color_med_atl[2],
color_med_atl[1],
color_med_atl[3],
color_med_atl[4]))
p2<-p
data_varpop=data.frame(PC=factor(paste("P",seq(1,10),sep=""),levels=paste("P",seq(1,10),sep="")),VAR=pca$varprop[1:10])
pp<-ggplot(data_varpop,aes(x=PC,y=VAR))+
geom_bar(stat='identity',fill="dodgerblue2",alpha=0.25)+
theme_classic()+
xlab("Principal Component")+
ylab("Variation explained (%)")
```
```{r}
subplot(ggplotly(p1)%>% layout(legend = list(orientation = "h", x = 0.2, y =-0.15)), ggplotly(p2)%>%hide_legend(), ggplotly(pp)%>%hide_legend(), titleX=T,titleY=T,margin=0.035,widths=c(0.375,0.425,0.2),which_layout=1) %>% partial_bundle()
```
### maf = 0.20
```{r}
pca=PCA_list$Prune_unfiltered$maf0.2[[1]]
data_pca=data.frame(INDIV=pca$sample.id,
PC1=pca$eigenvect[,1],
PC2=pca$eigenvect[,2],
PC3=pca$eigenvect[,3],
PC4=pca$eigenvect[,4],
LOCA=c(rep("Algarve",5),
rep("Bay of Biscay",5),
rep("Gulf of Lion",5),
rep("Costa Calida",5)))
color_med_atl=rev(brewer.pal(n=4,name="RdBu"))
p<-ggplot(data=data_pca,aes(x=PC1,y=PC2,label=INDIV))+
theme_minimal()+
theme(panel.grid=element_blank(),
panel.border=element_rect(fill="transparent"),
plot.title=element_text(hjust=0.5))+
geom_hline(yintercept=0,lty=2)+
geom_vline(xintercept=0,lty=2)+
geom_point(size=3,aes(col=LOCA))+
xlab(paste("PCA 1 (",round(pca$varprop[1]*100,2),"% )",sep=""))+
ylab(paste("PCA 2 (",round(pca$varprop[2]*100,2),"% )",sep=""))+
scale_colour_manual(name="Location",
values=c(color_med_atl[2],
color_med_atl[1],
color_med_atl[3],
color_med_atl[4]))
p1<-p
p<-ggplot(data=data_pca,aes(x=PC3,y=PC4,label=INDIV))+
theme_minimal()+
theme(panel.grid=element_blank(),
panel.border=element_rect(fill="transparent"),
plot.title=element_text(hjust=0.5))+
geom_hline(yintercept=0,lty=2)+
geom_vline(xintercept=0,lty=2)+
geom_point(size=3,aes(col=LOCA))+
xlab(paste("PCA 3 (",round(pca$varprop[3]*100,2),"% )",sep=""))+
ylab(paste("PCA 4 (",round(pca$varprop[4]*100,2),"% )",sep=""))+
scale_colour_manual(name="Location",
values=c(color_med_atl[2],
color_med_atl[1],
color_med_atl[3],
color_med_atl[4]))
p2<-p
data_varpop=data.frame(PC=factor(paste("P",seq(1,10),sep=""),levels=paste("P",seq(1,10),sep="")),VAR=pca$varprop[1:10])
pp<-ggplot(data_varpop,aes(x=PC,y=VAR))+
geom_bar(stat='identity',fill="dodgerblue2",alpha=0.25)+
theme_classic()+
xlab("Principal Component")+
ylab("Variation explained (%)")
```
```{r}
subplot(ggplotly(p1)%>% layout(legend = list(orientation = "h", x = 0.2, y =-0.15)), ggplotly(p2)%>%hide_legend(), ggplotly(pp)%>%hide_legend(), titleX=T,titleY=T,margin=0.035,widths=c(0.375,0.425,0.2),which_layout=1) %>% partial_bundle()
```
### maf = 0.25
```{r}
pca=PCA_list$Prune_unfiltered$maf0.25[[1]]
data_pca=data.frame(INDIV=pca$sample.id,
PC1=pca$eigenvect[,1],
PC2=pca$eigenvect[,2],
PC3=pca$eigenvect[,3],
PC4=pca$eigenvect[,4],
LOCA=c(rep("Algarve",5),
rep("Bay of Biscay",5),
rep("Gulf of Lion",5),
rep("Costa Calida",5)))
color_med_atl=rev(brewer.pal(n=4,name="RdBu"))
p<-ggplot(data=data_pca,aes(x=PC1,y=PC2,label=INDIV))+
theme_minimal()+
theme(panel.grid=element_blank(),
panel.border=element_rect(fill="transparent"),
plot.title=element_text(hjust=0.5))+
geom_hline(yintercept=0,lty=2)+
geom_vline(xintercept=0,lty=2)+
geom_point(size=3,aes(col=LOCA))+
xlab(paste("PCA 1 (",round(pca$varprop[1]*100,2),"% )",sep=""))+
ylab(paste("PCA 2 (",round(pca$varprop[2]*100,2),"% )",sep=""))+
scale_colour_manual(name="Location",
values=c(color_med_atl[2],
color_med_atl[1],
color_med_atl[3],
color_med_atl[4]))
p1<-p
p<-ggplot(data=data_pca,aes(x=PC3,y=PC4,label=INDIV))+
theme_minimal()+
theme(panel.grid=element_blank(),
panel.border=element_rect(fill="transparent"),
plot.title=element_text(hjust=0.5))+
geom_hline(yintercept=0,lty=2)+
geom_vline(xintercept=0,lty=2)+
geom_point(size=3,aes(col=LOCA))+
xlab(paste("PCA 3 (",round(pca$varprop[3]*100,2),"% )",sep=""))+
ylab(paste("PCA 4 (",round(pca$varprop[4]*100,2),"% )",sep=""))+
scale_colour_manual(name="Location",
values=c(color_med_atl[2],
color_med_atl[1],
color_med_atl[3],
color_med_atl[4]))
p2<-p
data_varpop=data.frame(PC=factor(paste("P",seq(1,10),sep=""),levels=paste("P",seq(1,10),sep="")),VAR=pca$varprop[1:10])
pp<-ggplot(data_varpop,aes(x=PC,y=VAR))+
geom_bar(stat='identity',fill="dodgerblue2",alpha=0.25)+
theme_classic()+
xlab("Principal Component")+
ylab("Variation explained (%)")
```
```{r}
subplot(ggplotly(p1)%>% layout(legend = list(orientation = "h", x = 0.2, y =-0.15)), ggplotly(p2)%>%hide_legend(), ggplotly(pp)%>%hide_legend(), titleX=T,titleY=T,margin=0.035,widths=c(0.375,0.425,0.2),which_layout=1) %>% partial_bundle()
```
### maf = 0.30
```{r}
pca=PCA_list$Prune_unfiltered$maf0.3[[1]]
data_pca=data.frame(INDIV=pca$sample.id,
PC1=pca$eigenvect[,1],
PC2=pca$eigenvect[,2],
PC3=pca$eigenvect[,3],
PC4=pca$eigenvect[,4],
LOCA=c(rep("Algarve",5),
rep("Bay of Biscay",5),
rep("Gulf of Lion",5),
rep("Costa Calida",5)))
color_med_atl=rev(brewer.pal(n=4,name="RdBu"))
p<-ggplot(data=data_pca,aes(x=PC1,y=PC2,label=INDIV))+
theme_minimal()+
theme(panel.grid=element_blank(),
panel.border=element_rect(fill="transparent"),
plot.title=element_text(hjust=0.5))+
geom_hline(yintercept=0,lty=2)+
geom_vline(xintercept=0,lty=2)+
geom_point(size=3,aes(col=LOCA))+
xlab(paste("PCA 1 (",round(pca$varprop[1]*100,2),"% )",sep=""))+
ylab(paste("PCA 2 (",round(pca$varprop[2]*100,2),"% )",sep=""))+
scale_colour_manual(name="Location",
values=c(color_med_atl[2],
color_med_atl[1],
color_med_atl[3],
color_med_atl[4]))
p1<-p
p<-ggplot(data=data_pca,aes(x=PC3,y=PC4,label=INDIV))+
theme_minimal()+
theme(panel.grid=element_blank(),
panel.border=element_rect(fill="transparent"),
plot.title=element_text(hjust=0.5))+
geom_hline(yintercept=0,lty=2)+
geom_vline(xintercept=0,lty=2)+
geom_point(size=3,aes(col=LOCA))+
xlab(paste("PCA 3 (",round(pca$varprop[3]*100,2),"% )",sep=""))+
ylab(paste("PCA 4 (",round(pca$varprop[4]*100,2),"% )",sep=""))+
scale_colour_manual(name="Location",
values=c(color_med_atl[2],
color_med_atl[1],
color_med_atl[3],
color_med_atl[4]))
p2<-p
data_varpop=data.frame(PC=factor(paste("P",seq(1,10),sep=""),levels=paste("P",seq(1,10),sep="")),VAR=pca$varprop[1:10])
pp<-ggplot(data_varpop,aes(x=PC,y=VAR))+
geom_bar(stat='identity',fill="dodgerblue2",alpha=0.25)+
theme_classic()+
xlab("Principal Component")+
ylab("Variation explained (%)")
```
```{r}
subplot(ggplotly(p1)%>% layout(legend = list(orientation = "h", x = 0.2, y =-0.15)), ggplotly(p2)%>%hide_legend(), ggplotly(pp)%>%hide_legend(), titleX=T,titleY=T,margin=0.035,widths=c(0.375,0.425,0.2),which_layout=1) %>% partial_bundle()
```
### maf = 0.35
```{r}
pca=PCA_list$Prune_unfiltered$maf0.35[[1]]
data_pca=data.frame(INDIV=pca$sample.id,
PC1=pca$eigenvect[,1],
PC2=pca$eigenvect[,2],
PC3=pca$eigenvect[,3],
PC4=pca$eigenvect[,4],
LOCA=c(rep("Algarve",5),
rep("Bay of Biscay",5),
rep("Gulf of Lion",5),
rep("Costa Calida",5)))
color_med_atl=rev(brewer.pal(n=4,name="RdBu"))
p<-ggplot(data=data_pca,aes(x=PC1,y=PC2,label=INDIV))+
theme_minimal()+
theme(panel.grid=element_blank(),
panel.border=element_rect(fill="transparent"),
plot.title=element_text(hjust=0.5))+
geom_hline(yintercept=0,lty=2)+
geom_vline(xintercept=0,lty=2)+
geom_point(size=3,aes(col=LOCA))+
xlab(paste("PCA 1 (",round(pca$varprop[1]*100,2),"% )",sep=""))+
ylab(paste("PCA 2 (",round(pca$varprop[2]*100,2),"% )",sep=""))+
scale_colour_manual(name="Location",
values=c(color_med_atl[2],
color_med_atl[1],
color_med_atl[3],
color_med_atl[4]))
p1<-p
p<-ggplot(data=data_pca,aes(x=PC3,y=PC4,label=INDIV))+
theme_minimal()+
theme(panel.grid=element_blank(),
panel.border=element_rect(fill="transparent"),
plot.title=element_text(hjust=0.5))+
geom_hline(yintercept=0,lty=2)+
geom_vline(xintercept=0,lty=2)+
geom_point(size=3,aes(col=LOCA))+
xlab(paste("PCA 3 (",round(pca$varprop[3]*100,2),"% )",sep=""))+
ylab(paste("PCA 4 (",round(pca$varprop[4]*100,2),"% )",sep=""))+
scale_colour_manual(name="Location",
values=c(color_med_atl[2],
color_med_atl[1],
color_med_atl[3],
color_med_atl[4]))
p2<-p
data_varpop=data.frame(PC=factor(paste("P",seq(1,10),sep=""),levels=paste("P",seq(1,10),sep="")),VAR=pca$varprop[1:10])
pp<-ggplot(data_varpop,aes(x=PC,y=VAR))+
geom_bar(stat='identity',fill="dodgerblue2",alpha=0.25)+
theme_classic()+
xlab("Principal Component")+
ylab("Variation explained (%)")
```
```{r}
subplot(ggplotly(p1)%>% layout(legend = list(orientation = "h", x = 0.2, y =-0.15)), ggplotly(p2)%>%hide_legend(), ggplotly(pp)%>%hide_legend(), titleX=T,titleY=T,margin=0.035,widths=c(0.375,0.425,0.2),which_layout=1) %>% partial_bundle()
```
### maf = 0.40
```{r}
pca=PCA_list$Prune_unfiltered$maf0.4[[1]]
data_pca=data.frame(INDIV=pca$sample.id,
PC1=pca$eigenvect[,1],
PC2=pca$eigenvect[,2],
PC3=pca$eigenvect[,3],
PC4=pca$eigenvect[,4],
LOCA=c(rep("Algarve",5),
rep("Bay of Biscay",5),
rep("Gulf of Lion",5),
rep("Costa Calida",5)))
color_med_atl=rev(brewer.pal(n=4,name="RdBu"))
p<-ggplot(data=data_pca,aes(x=PC1,y=PC2,label=INDIV))+
theme_minimal()+
theme(panel.grid=element_blank(),
panel.border=element_rect(fill="transparent"),
plot.title=element_text(hjust=0.5))+
geom_hline(yintercept=0,lty=2)+
geom_vline(xintercept=0,lty=2)+
geom_point(size=3,aes(col=LOCA))+
xlab(paste("PCA 1 (",round(pca$varprop[1]*100,2),"% )",sep=""))+
ylab(paste("PCA 2 (",round(pca$varprop[2]*100,2),"% )",sep=""))+
scale_colour_manual(name="Location",
values=c(color_med_atl[2],
color_med_atl[1],
color_med_atl[3],
color_med_atl[4]))
p1<-p
p<-ggplot(data=data_pca,aes(x=PC3,y=PC4,label=INDIV))+
theme_minimal()+
theme(panel.grid=element_blank(),
panel.border=element_rect(fill="transparent"),
plot.title=element_text(hjust=0.5))+
geom_hline(yintercept=0,lty=2)+
geom_vline(xintercept=0,lty=2)+
geom_point(size=3,aes(col=LOCA))+
xlab(paste("PCA 3 (",round(pca$varprop[3]*100,2),"% )",sep=""))+
ylab(paste("PCA 4 (",round(pca$varprop[4]*100,2),"% )",sep=""))+
scale_colour_manual(name="Location",
values=c(color_med_atl[2],
color_med_atl[1],
color_med_atl[3],
color_med_atl[4]))
p2<-p
data_varpop=data.frame(PC=factor(paste("P",seq(1,10),sep=""),levels=paste("P",seq(1,10),sep="")),VAR=pca$varprop[1:10])
pp<-ggplot(data_varpop,aes(x=PC,y=VAR))+
geom_bar(stat='identity',fill="dodgerblue2",alpha=0.25)+
theme_classic()+
xlab("Principal Component")+
ylab("Variation explained (%)")
```
```{r}
subplot(ggplotly(p1)%>% layout(legend = list(orientation = "h", x = 0.2, y =-0.15)), ggplotly(p2)%>%hide_legend(), ggplotly(pp)%>%hide_legend(), titleX=T,titleY=T,margin=0.035,widths=c(0.375,0.425,0.2),which_layout=1) %>% partial_bundle()
```
### maf = 0.45
```{r}
pca=PCA_list$Prune_unfiltered$maf0.45[[1]]
data_pca=data.frame(INDIV=pca$sample.id,
PC1=pca$eigenvect[,1],
PC2=pca$eigenvect[,2],
PC3=pca$eigenvect[,3],
PC4=pca$eigenvect[,4],
LOCA=c(rep("Algarve",5),
rep("Bay of Biscay",5),
rep("Gulf of Lion",5),
rep("Costa Calida",5)))
color_med_atl=rev(brewer.pal(n=4,name="RdBu"))
p<-ggplot(data=data_pca,aes(x=PC1,y=PC2,label=INDIV))+
theme_minimal()+
theme(panel.grid=element_blank(),
panel.border=element_rect(fill="transparent"),
plot.title=element_text(hjust=0.5))+
geom_hline(yintercept=0,lty=2)+
geom_vline(xintercept=0,lty=2)+
geom_point(size=3,aes(col=LOCA))+
xlab(paste("PCA 1 (",round(pca$varprop[1]*100,2),"% )",sep=""))+
ylab(paste("PCA 2 (",round(pca$varprop[2]*100,2),"% )",sep=""))+
scale_colour_manual(name="Location",
values=c(color_med_atl[2],
color_med_atl[1],
color_med_atl[3],
color_med_atl[4]))
p1<-p
p<-ggplot(data=data_pca,aes(x=PC3,y=PC4,label=INDIV))+
theme_minimal()+
theme(panel.grid=element_blank(),
panel.border=element_rect(fill="transparent"),
plot.title=element_text(hjust=0.5))+
geom_hline(yintercept=0,lty=2)+
geom_vline(xintercept=0,lty=2)+
geom_point(size=3,aes(col=LOCA))+
xlab(paste("PCA 3 (",round(pca$varprop[3]*100,2),"% )",sep=""))+
ylab(paste("PCA 4 (",round(pca$varprop[4]*100,2),"% )",sep=""))+
scale_colour_manual(name="Location",
values=c(color_med_atl[2],
color_med_atl[1],
color_med_atl[3],
color_med_atl[4]))
p2<-p
data_varpop=data.frame(PC=factor(paste("P",seq(1,10),sep=""),levels=paste("P",seq(1,10),sep="")),VAR=pca$varprop[1:10])
pp<-ggplot(data_varpop,aes(x=PC,y=VAR))+
geom_bar(stat='identity',fill="dodgerblue2",alpha=0.25)+
theme_classic()+
xlab("Principal Component")+
ylab("Variation explained (%)")
```
```{r}
subplot(ggplotly(p1)%>% layout(legend = list(orientation = "h", x = 0.2, y =-0.15)), ggplotly(p2)%>%hide_legend(), ggplotly(pp)%>%hide_legend(), titleX=T,titleY=T,margin=0.035,widths=c(0.375,0.425,0.2),which_layout=1) %>% partial_bundle()
```
### maf = 0.50
```{r}
pca=PCA_list$Prune_unfiltered$maf0.5[[1]]
data_pca=data.frame(INDIV=pca$sample.id,
PC1=pca$eigenvect[,1],
PC2=pca$eigenvect[,2],
PC3=pca$eigenvect[,3],
PC4=pca$eigenvect[,4],
LOCA=c(rep("Algarve",5),
rep("Bay of Biscay",5),
rep("Gulf of Lion",5),
rep("Costa Calida",5)))
color_med_atl=rev(brewer.pal(n=4,name="RdBu"))
p<-ggplot(data=data_pca,aes(x=PC1,y=PC2,label=INDIV))+
theme_minimal()+
theme(panel.grid=element_blank(),
panel.border=element_rect(fill="transparent"),
plot.title=element_text(hjust=0.5))+
geom_hline(yintercept=0,lty=2)+
geom_vline(xintercept=0,lty=2)+
geom_point(size=3,aes(col=LOCA))+
xlab(paste("PCA 1 (",round(pca$varprop[1]*100,2),"% )",sep=""))+
ylab(paste("PCA 2 (",round(pca$varprop[2]*100,2),"% )",sep=""))+
scale_colour_manual(name="Location",
values=c(color_med_atl[2],
color_med_atl[1],
color_med_atl[3],
color_med_atl[4]))
p1<-p
p<-ggplot(data=data_pca,aes(x=PC3,y=PC4,label=INDIV))+
theme_minimal()+
theme(panel.grid=element_blank(),
panel.border=element_rect(fill="transparent"),
plot.title=element_text(hjust=0.5))+
geom_hline(yintercept=0,lty=2)+
geom_vline(xintercept=0,lty=2)+
geom_point(size=3,aes(col=LOCA))+
xlab(paste("PCA 3 (",round(pca$varprop[3]*100,2),"% )",sep=""))+
ylab(paste("PCA 4 (",round(pca$varprop[4]*100,2),"% )",sep=""))+
scale_colour_manual(name="Location",
values=c(color_med_atl[2],
color_med_atl[1],
color_med_atl[3],
color_med_atl[4]))
p2<-p
data_varpop=data.frame(PC=factor(paste("P",seq(1,10),sep=""),levels=paste("P",seq(1,10),sep="")),VAR=pca$varprop[1:10])
pp<-ggplot(data_varpop,aes(x=PC,y=VAR))+
geom_bar(stat='identity',fill="dodgerblue2",alpha=0.25)+
theme_classic()+
xlab("Principal Component")+
ylab("Variation explained (%)")
```
```{r}
subplot(ggplotly(p1)%>% layout(legend = list(orientation = "h", x = 0.2, y =-0.15)), ggplotly(p2)%>%hide_legend(), ggplotly(pp)%>%hide_legend(), titleX=T,titleY=T,margin=0.035,widths=c(0.375,0.425,0.2),which_layout=1) %>% partial_bundle()
```
Symphodus cinereus {data-navmenu="Species"}
=======================================================================
```{r, include = FALSE}
load(file = paste(path,"/output/pca/Scine_PCA_list.Rdata",sep=""))
```
Row {.tabset data-height=100}
-----------------------
<center>
<font size="6">**Symphodus cinereus**</font>
</center>
Row {.tabset data-height=50}
-----------------------
<center>
<font size="6">**All filtered SNPS**</font>
</center>
Row {.tabset data-height=600}
-----------------------
### maf = 0
```{r}
pca=PCA_list$All_filtered$maf0[[1]]
data_pca=data.frame(INDIV=pca$sample.id,
PC1=pca$eigenvect[,1],
PC2=pca$eigenvect[,2],
PC3=pca$eigenvect[,3],
PC4=pca$eigenvect[,4],
LOCA=c(rep("Algarve",5),
rep("Bay of Biscay",5),
rep("Gulf of Lion",5),
rep("Costa Calida",5)))
color_med_atl=rev(brewer.pal(n=4,name="RdBu"))
p<-ggplot(data=data_pca,aes(x=PC1,y=PC2,label=INDIV))+
theme_minimal()+
theme(panel.grid=element_blank(),
panel.border=element_rect(fill="transparent"),
plot.title=element_text(hjust=0.5))+
geom_hline(yintercept=0,lty=2)+
geom_vline(xintercept=0,lty=2)+
geom_point(size=3,aes(col=LOCA))+
xlab(paste("PCA 1 (",round(pca$varprop[1]*100,2),"% )",sep=""))+
ylab(paste("PCA 2 (",round(pca$varprop[2]*100,2),"% )",sep=""))+
scale_colour_manual(name="Location",
values=c(color_med_atl[2],
color_med_atl[1],
color_med_atl[3],
color_med_atl[4]))
p1<-p
p<-ggplot(data=data_pca,aes(x=PC3,y=PC4,label=INDIV))+
theme_minimal()+
theme(panel.grid=element_blank(),
panel.border=element_rect(fill="transparent"),
plot.title=element_text(hjust=0.5))+
geom_hline(yintercept=0,lty=2)+
geom_vline(xintercept=0,lty=2)+
geom_point(size=3,aes(col=LOCA))+
xlab(paste("PCA 3 (",round(pca$varprop[3]*100,2),"% )",sep=""))+
ylab(paste("PCA 4 (",round(pca$varprop[4]*100,2),"% )",sep=""))+
scale_colour_manual(name="Location",
values=c(color_med_atl[2],
color_med_atl[1],
color_med_atl[3],
color_med_atl[4]))
p2<-p
data_varpop=data.frame(PC=factor(paste("P",seq(1,10),sep=""),levels=paste("P",seq(1,10),sep="")),VAR=pca$varprop[1:10])
pp<-ggplot(data_varpop,aes(x=PC,y=VAR))+
geom_bar(stat='identity',fill="dodgerblue2",alpha=0.25)+
theme_classic()+
xlab("Principal Component")+
ylab("Variation explained (%)")
```
```{r}
subplot(ggplotly(p1)%>% layout(legend = list(orientation = "h", x = 0.2, y =-0.15)), ggplotly(p2)%>%hide_legend(), ggplotly(pp)%>%hide_legend(), titleX=T,titleY=T,margin=0.035,widths=c(0.375,0.425,0.2),which_layout=1) %>% partial_bundle()
```
### maf = 0.05
```{r}
pca=PCA_list$All_filtered$maf0.05[[1]]
data_pca=data.frame(INDIV=pca$sample.id,
PC1=pca$eigenvect[,1],
PC2=pca$eigenvect[,2],
PC3=pca$eigenvect[,3],
PC4=pca$eigenvect[,4],
LOCA=c(rep("Algarve",5),
rep("Bay of Biscay",5),
rep("Gulf of Lion",5),
rep("Costa Calida",5)))
color_med_atl=rev(brewer.pal(n=4,name="RdBu"))
p<-ggplot(data=data_pca,aes(x=PC1,y=PC2,label=INDIV))+
theme_minimal()+
theme(panel.grid=element_blank(),
panel.border=element_rect(fill="transparent"),
plot.title=element_text(hjust=0.5))+
geom_hline(yintercept=0,lty=2)+
geom_vline(xintercept=0,lty=2)+
geom_point(size=3,aes(col=LOCA))+
xlab(paste("PCA 1 (",round(pca$varprop[1]*100,2),"% )",sep=""))+
ylab(paste("PCA 2 (",round(pca$varprop[2]*100,2),"% )",sep=""))+
scale_colour_manual(name="Location",
values=c(color_med_atl[2],
color_med_atl[1],
color_med_atl[3],
color_med_atl[4]))
p1<-p
p<-ggplot(data=data_pca,aes(x=PC3,y=PC4,label=INDIV))+
theme_minimal()+
theme(panel.grid=element_blank(),
panel.border=element_rect(fill="transparent"),
plot.title=element_text(hjust=0.5))+
geom_hline(yintercept=0,lty=2)+
geom_vline(xintercept=0,lty=2)+
geom_point(size=3,aes(col=LOCA))+
xlab(paste("PCA 3 (",round(pca$varprop[3]*100,2),"% )",sep=""))+
ylab(paste("PCA 4 (",round(pca$varprop[4]*100,2),"% )",sep=""))+
scale_colour_manual(name="Location",
values=c(color_med_atl[2],
color_med_atl[1],
color_med_atl[3],
color_med_atl[4]))
p2<-p
data_varpop=data.frame(PC=factor(paste("P",seq(1,10),sep=""),levels=paste("P",seq(1,10),sep="")),VAR=pca$varprop[1:10])
pp<-ggplot(data_varpop,aes(x=PC,y=VAR))+
geom_bar(stat='identity',fill="dodgerblue2",alpha=0.25)+
theme_classic()+
xlab("Principal Component")+
ylab("Variation explained (%)")
```
```{r}
subplot(ggplotly(p1)%>% layout(legend = list(orientation = "h", x = 0.2, y =-0.15)), ggplotly(p2)%>%hide_legend(), ggplotly(pp)%>%hide_legend(), titleX=T,titleY=T,margin=0.035,widths=c(0.375,0.425,0.2),which_layout=1) %>% partial_bundle()
```
### maf = 0.1
```{r}
pca=PCA_list$All_filtered$maf0.1[[1]]
data_pca=data.frame(INDIV=pca$sample.id,
PC1=pca$eigenvect[,1],
PC2=pca$eigenvect[,2],
PC3=pca$eigenvect[,3],
PC4=pca$eigenvect[,4],
LOCA=c(rep("Algarve",5),
rep("Bay of Biscay",5),
rep("Gulf of Lion",5),
rep("Costa Calida",5)))
color_med_atl=rev(brewer.pal(n=4,name="RdBu"))
p<-ggplot(data=data_pca,aes(x=PC1,y=PC2,label=INDIV))+
theme_minimal()+
theme(panel.grid=element_blank(),
panel.border=element_rect(fill="transparent"),
plot.title=element_text(hjust=0.5))+
geom_hline(yintercept=0,lty=2)+
geom_vline(xintercept=0,lty=2)+
geom_point(size=3,aes(col=LOCA))+
xlab(paste("PCA 1 (",round(pca$varprop[1]*100,2),"% )",sep=""))+
ylab(paste("PCA 2 (",round(pca$varprop[2]*100,2),"% )",sep=""))+
scale_colour_manual(name="Location",
values=c(color_med_atl[2],
color_med_atl[1],
color_med_atl[3],
color_med_atl[4]))
p1<-p
p<-ggplot(data=data_pca,aes(x=PC3,y=PC4,label=INDIV))+
theme_minimal()+
theme(panel.grid=element_blank(),
panel.border=element_rect(fill="transparent"),
plot.title=element_text(hjust=0.5))+
geom_hline(yintercept=0,lty=2)+
geom_vline(xintercept=0,lty=2)+
geom_point(size=3,aes(col=LOCA))+
xlab(paste("PCA 3 (",round(pca$varprop[3]*100,2),"% )",sep=""))+
ylab(paste("PCA 4 (",round(pca$varprop[4]*100,2),"% )",sep=""))+
scale_colour_manual(name="Location",
values=c(color_med_atl[2],
color_med_atl[1],
color_med_atl[3],
color_med_atl[4]))
p2<-p
data_varpop=data.frame(PC=factor(paste("P",seq(1,10),sep=""),levels=paste("P",seq(1,10),sep="")),VAR=pca$varprop[1:10])
pp<-ggplot(data_varpop,aes(x=PC,y=VAR))+
geom_bar(stat='identity',fill="dodgerblue2",alpha=0.25)+
theme_classic()+
xlab("Principal Component")+
ylab("Variation explained (%)")
```
```{r}
subplot(ggplotly(p1)%>% layout(legend = list(orientation = "h", x = 0.2, y =-0.15)), ggplotly(p2)%>%hide_legend(), ggplotly(pp)%>%hide_legend(), titleX=T,titleY=T,margin=0.035,widths=c(0.375,0.425,0.2),which_layout=1) %>% partial_bundle()
```
### maf = 0.15
```{r}
pca=PCA_list$All_filtered$maf0.15[[1]]
data_pca=data.frame(INDIV=pca$sample.id,
PC1=pca$eigenvect[,1],
PC2=pca$eigenvect[,2],
PC3=pca$eigenvect[,3],
PC4=pca$eigenvect[,4],
LOCA=c(rep("Algarve",5),
rep("Bay of Biscay",5),
rep("Gulf of Lion",5),
rep("Costa Calida",5)))
color_med_atl=rev(brewer.pal(n=4,name="RdBu"))
p<-ggplot(data=data_pca,aes(x=PC1,y=PC2,label=INDIV))+
theme_minimal()+
theme(panel.grid=element_blank(),
panel.border=element_rect(fill="transparent"),
plot.title=element_text(hjust=0.5))+
geom_hline(yintercept=0,lty=2)+
geom_vline(xintercept=0,lty=2)+
geom_point(size=3,aes(col=LOCA))+
xlab(paste("PCA 1 (",round(pca$varprop[1]*100,2),"% )",sep=""))+
ylab(paste("PCA 2 (",round(pca$varprop[2]*100,2),"% )",sep=""))+
scale_colour_manual(name="Location",
values=c(color_med_atl[2],
color_med_atl[1],
color_med_atl[3],
color_med_atl[4]))
p1<-p
p<-ggplot(data=data_pca,aes(x=PC3,y=PC4,label=INDIV))+
theme_minimal()+
theme(panel.grid=element_blank(),
panel.border=element_rect(fill="transparent"),
plot.title=element_text(hjust=0.5))+
geom_hline(yintercept=0,lty=2)+
geom_vline(xintercept=0,lty=2)+
geom_point(size=3,aes(col=LOCA))+
xlab(paste("PCA 3 (",round(pca$varprop[3]*100,2),"% )",sep=""))+
ylab(paste("PCA 4 (",round(pca$varprop[4]*100,2),"% )",sep=""))+
scale_colour_manual(name="Location",
values=c(color_med_atl[2],
color_med_atl[1],
color_med_atl[3],
color_med_atl[4]))
p2<-p
data_varpop=data.frame(PC=factor(paste("P",seq(1,10),sep=""),levels=paste("P",seq(1,10),sep="")),VAR=pca$varprop[1:10])
pp<-ggplot(data_varpop,aes(x=PC,y=VAR))+
geom_bar(stat='identity',fill="dodgerblue2",alpha=0.25)+
theme_classic()+
xlab("Principal Component")+
ylab("Variation explained (%)")
```
```{r}
subplot(ggplotly(p1)%>% layout(legend = list(orientation = "h", x = 0.2, y =-0.15)), ggplotly(p2)%>%hide_legend(), ggplotly(pp)%>%hide_legend(), titleX=T,titleY=T,margin=0.035,widths=c(0.375,0.425,0.2),which_layout=1) %>% partial_bundle()
```
### maf = 0.20
```{r}
pca=PCA_list$All_filtered$maf0.2[[1]]
data_pca=data.frame(INDIV=pca$sample.id,
PC1=pca$eigenvect[,1],
PC2=pca$eigenvect[,2],
PC3=pca$eigenvect[,3],
PC4=pca$eigenvect[,4],
LOCA=c(rep("Algarve",5),
rep("Bay of Biscay",5),
rep("Gulf of Lion",5),
rep("Costa Calida",5)))
color_med_atl=rev(brewer.pal(n=4,name="RdBu"))
p<-ggplot(data=data_pca,aes(x=PC1,y=PC2,label=INDIV))+
theme_minimal()+
theme(panel.grid=element_blank(),
panel.border=element_rect(fill="transparent"),
plot.title=element_text(hjust=0.5))+
geom_hline(yintercept=0,lty=2)+
geom_vline(xintercept=0,lty=2)+
geom_point(size=3,aes(col=LOCA))+
xlab(paste("PCA 1 (",round(pca$varprop[1]*100,2),"% )",sep=""))+
ylab(paste("PCA 2 (",round(pca$varprop[2]*100,2),"% )",sep=""))+
scale_colour_manual(name="Location",
values=c(color_med_atl[2],
color_med_atl[1],
color_med_atl[3],
color_med_atl[4]))
p1<-p
p<-ggplot(data=data_pca,aes(x=PC3,y=PC4,label=INDIV))+
theme_minimal()+
theme(panel.grid=element_blank(),
panel.border=element_rect(fill="transparent"),
plot.title=element_text(hjust=0.5))+
geom_hline(yintercept=0,lty=2)+
geom_vline(xintercept=0,lty=2)+
geom_point(size=3,aes(col=LOCA))+
xlab(paste("PCA 3 (",round(pca$varprop[3]*100,2),"% )",sep=""))+
ylab(paste("PCA 4 (",round(pca$varprop[4]*100,2),"% )",sep=""))+
scale_colour_manual(name="Location",
values=c(color_med_atl[2],
color_med_atl[1],
color_med_atl[3],
color_med_atl[4]))
p2<-p
data_varpop=data.frame(PC=factor(paste("P",seq(1,10),sep=""),levels=paste("P",seq(1,10),sep="")),VAR=pca$varprop[1:10])
pp<-ggplot(data_varpop,aes(x=PC,y=VAR))+
geom_bar(stat='identity',fill="dodgerblue2",alpha=0.25)+
theme_classic()+
xlab("Principal Component")+
ylab("Variation explained (%)")
```
```{r}
subplot(ggplotly(p1)%>% layout(legend = list(orientation = "h", x = 0.2, y =-0.15)), ggplotly(p2)%>%hide_legend(), ggplotly(pp)%>%hide_legend(), titleX=T,titleY=T,margin=0.035,widths=c(0.375,0.425,0.2),which_layout=1) %>% partial_bundle()
```
### maf = 0.25
```{r}
pca=PCA_list$All_filtered$maf0.25[[1]]
data_pca=data.frame(INDIV=pca$sample.id,
PC1=pca$eigenvect[,1],
PC2=pca$eigenvect[,2],
PC3=pca$eigenvect[,3],
PC4=pca$eigenvect[,4],
LOCA=c(rep("Algarve",5),
rep("Bay of Biscay",5),
rep("Gulf of Lion",5),
rep("Costa Calida",5)))
color_med_atl=rev(brewer.pal(n=4,name="RdBu"))
p<-ggplot(data=data_pca,aes(x=PC1,y=PC2,label=INDIV))+
theme_minimal()+
theme(panel.grid=element_blank(),
panel.border=element_rect(fill="transparent"),
plot.title=element_text(hjust=0.5))+
geom_hline(yintercept=0,lty=2)+
geom_vline(xintercept=0,lty=2)+
geom_point(size=3,aes(col=LOCA))+
xlab(paste("PCA 1 (",round(pca$varprop[1]*100,2),"% )",sep=""))+
ylab(paste("PCA 2 (",round(pca$varprop[2]*100,2),"% )",sep=""))+
scale_colour_manual(name="Location",
values=c(color_med_atl[2],
color_med_atl[1],
color_med_atl[3],
color_med_atl[4]))
p1<-p
p<-ggplot(data=data_pca,aes(x=PC3,y=PC4,label=INDIV))+
theme_minimal()+
theme(panel.grid=element_blank(),
panel.border=element_rect(fill="transparent"),
plot.title=element_text(hjust=0.5))+
geom_hline(yintercept=0,lty=2)+
geom_vline(xintercept=0,lty=2)+
geom_point(size=3,aes(col=LOCA))+
xlab(paste("PCA 3 (",round(pca$varprop[3]*100,2),"% )",sep=""))+
ylab(paste("PCA 4 (",round(pca$varprop[4]*100,2),"% )",sep=""))+
scale_colour_manual(name="Location",
values=c(color_med_atl[2],
color_med_atl[1],
color_med_atl[3],
color_med_atl[4]))
p2<-p
data_varpop=data.frame(PC=factor(paste("P",seq(1,10),sep=""),levels=paste("P",seq(1,10),sep="")),VAR=pca$varprop[1:10])
pp<-ggplot(data_varpop,aes(x=PC,y=VAR))+
geom_bar(stat='identity',fill="dodgerblue2",alpha=0.25)+
theme_classic()+
xlab("Principal Component")+
ylab("Variation explained (%)")
```
```{r}
subplot(ggplotly(p1)%>% layout(legend = list(orientation = "h", x = 0.2, y =-0.15)), ggplotly(p2)%>%hide_legend(), ggplotly(pp)%>%hide_legend(), titleX=T,titleY=T,margin=0.035,widths=c(0.375,0.425,0.2),which_layout=1) %>% partial_bundle()
```
### maf = 0.30
```{r}
pca=PCA_list$All_filtered$maf0.3[[1]]
data_pca=data.frame(INDIV=pca$sample.id,
PC1=pca$eigenvect[,1],
PC2=pca$eigenvect[,2],
PC3=pca$eigenvect[,3],
PC4=pca$eigenvect[,4],
LOCA=c(rep("Algarve",5),
rep("Bay of Biscay",5),
rep("Gulf of Lion",5),
rep("Costa Calida",5)))
color_med_atl=rev(brewer.pal(n=4,name="RdBu"))
p<-ggplot(data=data_pca,aes(x=PC1,y=PC2,label=INDIV))+
theme_minimal()+
theme(panel.grid=element_blank(),
panel.border=element_rect(fill="transparent"),
plot.title=element_text(hjust=0.5))+
geom_hline(yintercept=0,lty=2)+
geom_vline(xintercept=0,lty=2)+
geom_point(size=3,aes(col=LOCA))+
xlab(paste("PCA 1 (",round(pca$varprop[1]*100,2),"% )",sep=""))+
ylab(paste("PCA 2 (",round(pca$varprop[2]*100,2),"% )",sep=""))+
scale_colour_manual(name="Location",
values=c(color_med_atl[2],
color_med_atl[1],
color_med_atl[3],
color_med_atl[4]))
p1<-p
p<-ggplot(data=data_pca,aes(x=PC3,y=PC4,label=INDIV))+
theme_minimal()+
theme(panel.grid=element_blank(),
panel.border=element_rect(fill="transparent"),
plot.title=element_text(hjust=0.5))+
geom_hline(yintercept=0,lty=2)+
geom_vline(xintercept=0,lty=2)+
geom_point(size=3,aes(col=LOCA))+
xlab(paste("PCA 3 (",round(pca$varprop[3]*100,2),"% )",sep=""))+
ylab(paste("PCA 4 (",round(pca$varprop[4]*100,2),"% )",sep=""))+
scale_colour_manual(name="Location",
values=c(color_med_atl[2],
color_med_atl[1],
color_med_atl[3],
color_med_atl[4]))
p2<-p
data_varpop=data.frame(PC=factor(paste("P",seq(1,10),sep=""),levels=paste("P",seq(1,10),sep="")),VAR=pca$varprop[1:10])
pp<-ggplot(data_varpop,aes(x=PC,y=VAR))+
geom_bar(stat='identity',fill="dodgerblue2",alpha=0.25)+
theme_classic()+
xlab("Principal Component")+
ylab("Variation explained (%)")
```
```{r}
subplot(ggplotly(p1)%>% layout(legend = list(orientation = "h", x = 0.2, y =-0.15)), ggplotly(p2)%>%hide_legend(), ggplotly(pp)%>%hide_legend(), titleX=T,titleY=T,margin=0.035,widths=c(0.375,0.425,0.2),which_layout=1) %>% partial_bundle()
```
### maf = 0.35
```{r}
pca=PCA_list$All_filtered$maf0.35[[1]]
data_pca=data.frame(INDIV=pca$sample.id,
PC1=pca$eigenvect[,1],
PC2=pca$eigenvect[,2],
PC3=pca$eigenvect[,3],
PC4=pca$eigenvect[,4],
LOCA=c(rep("Algarve",5),
rep("Bay of Biscay",5),
rep("Gulf of Lion",5),
rep("Costa Calida",5)))
color_med_atl=rev(brewer.pal(n=4,name="RdBu"))
p<-ggplot(data=data_pca,aes(x=PC1,y=PC2,label=INDIV))+
theme_minimal()+
theme(panel.grid=element_blank(),
panel.border=element_rect(fill="transparent"),
plot.title=element_text(hjust=0.5))+
geom_hline(yintercept=0,lty=2)+
geom_vline(xintercept=0,lty=2)+
geom_point(size=3,aes(col=LOCA))+
xlab(paste("PCA 1 (",round(pca$varprop[1]*100,2),"% )",sep=""))+
ylab(paste("PCA 2 (",round(pca$varprop[2]*100,2),"% )",sep=""))+
scale_colour_manual(name="Location",
values=c(color_med_atl[2],
color_med_atl[1],
color_med_atl[3],
color_med_atl[4]))
p1<-p
p<-ggplot(data=data_pca,aes(x=PC3,y=PC4,label=INDIV))+
theme_minimal()+
theme(panel.grid=element_blank(),
panel.border=element_rect(fill="transparent"),
plot.title=element_text(hjust=0.5))+
geom_hline(yintercept=0,lty=2)+
geom_vline(xintercept=0,lty=2)+
geom_point(size=3,aes(col=LOCA))+
xlab(paste("PCA 3 (",round(pca$varprop[3]*100,2),"% )",sep=""))+
ylab(paste("PCA 4 (",round(pca$varprop[4]*100,2),"% )",sep=""))+
scale_colour_manual(name="Location",
values=c(color_med_atl[2],
color_med_atl[1],
color_med_atl[3],
color_med_atl[4]))
p2<-p
data_varpop=data.frame(PC=factor(paste("P",seq(1,10),sep=""),levels=paste("P",seq(1,10),sep="")),VAR=pca$varprop[1:10])
pp<-ggplot(data_varpop,aes(x=PC,y=VAR))+
geom_bar(stat='identity',fill="dodgerblue2",alpha=0.25)+
theme_classic()+
xlab("Principal Component")+
ylab("Variation explained (%)")
```
```{r}
subplot(ggplotly(p1)%>% layout(legend = list(orientation = "h", x = 0.2, y =-0.15)), ggplotly(p2)%>%hide_legend(), ggplotly(pp)%>%hide_legend(), titleX=T,titleY=T,margin=0.035,widths=c(0.375,0.425,0.2),which_layout=1) %>% partial_bundle()
```
### maf = 0.40
```{r}
pca=PCA_list$All_filtered$maf0.4[[1]]
data_pca=data.frame(INDIV=pca$sample.id,
PC1=pca$eigenvect[,1],
PC2=pca$eigenvect[,2],
PC3=pca$eigenvect[,3],
PC4=pca$eigenvect[,4],
LOCA=c(rep("Algarve",5),
rep("Bay of Biscay",5),
rep("Gulf of Lion",5),
rep("Costa Calida",5)))
color_med_atl=rev(brewer.pal(n=4,name="RdBu"))
p<-ggplot(data=data_pca,aes(x=PC1,y=PC2,label=INDIV))+
theme_minimal()+
theme(panel.grid=element_blank(),
panel.border=element_rect(fill="transparent"),
plot.title=element_text(hjust=0.5))+
geom_hline(yintercept=0,lty=2)+
geom_vline(xintercept=0,lty=2)+
geom_point(size=3,aes(col=LOCA))+
xlab(paste("PCA 1 (",round(pca$varprop[1]*100,2),"% )",sep=""))+
ylab(paste("PCA 2 (",round(pca$varprop[2]*100,2),"% )",sep=""))+
scale_colour_manual(name="Location",
values=c(color_med_atl[2],
color_med_atl[1],
color_med_atl[3],
color_med_atl[4]))
p1<-p
p<-ggplot(data=data_pca,aes(x=PC3,y=PC4,label=INDIV))+
theme_minimal()+
theme(panel.grid=element_blank(),
panel.border=element_rect(fill="transparent"),
plot.title=element_text(hjust=0.5))+
geom_hline(yintercept=0,lty=2)+
geom_vline(xintercept=0,lty=2)+
geom_point(size=3,aes(col=LOCA))+
xlab(paste("PCA 3 (",round(pca$varprop[3]*100,2),"% )",sep=""))+
ylab(paste("PCA 4 (",round(pca$varprop[4]*100,2),"% )",sep=""))+
scale_colour_manual(name="Location",
values=c(color_med_atl[2],
color_med_atl[1],
color_med_atl[3],
color_med_atl[4]))
p2<-p
data_varpop=data.frame(PC=factor(paste("P",seq(1,10),sep=""),levels=paste("P",seq(1,10),sep="")),VAR=pca$varprop[1:10])
pp<-ggplot(data_varpop,aes(x=PC,y=VAR))+
geom_bar(stat='identity',fill="dodgerblue2",alpha=0.25)+
theme_classic()+
xlab("Principal Component")+
ylab("Variation explained (%)")
```
```{r}
subplot(ggplotly(p1)%>% layout(legend = list(orientation = "h", x = 0.2, y =-0.15)), ggplotly(p2)%>%hide_legend(), ggplotly(pp)%>%hide_legend(), titleX=T,titleY=T,margin=0.035,widths=c(0.375,0.425,0.2),which_layout=1) %>% partial_bundle()
```
### maf = 0.45
```{r}
pca=PCA_list$All_filtered$maf0.45[[1]]
data_pca=data.frame(INDIV=pca$sample.id,
PC1=pca$eigenvect[,1],
PC2=pca$eigenvect[,2],
PC3=pca$eigenvect[,3],
PC4=pca$eigenvect[,4],
LOCA=c(rep("Algarve",5),
rep("Bay of Biscay",5),
rep("Gulf of Lion",5),
rep("Costa Calida",5)))
color_med_atl=rev(brewer.pal(n=4,name="RdBu"))
p<-ggplot(data=data_pca,aes(x=PC1,y=PC2,label=INDIV))+
theme_minimal()+
theme(panel.grid=element_blank(),
panel.border=element_rect(fill="transparent"),
plot.title=element_text(hjust=0.5))+
geom_hline(yintercept=0,lty=2)+
geom_vline(xintercept=0,lty=2)+
geom_point(size=3,aes(col=LOCA))+
xlab(paste("PCA 1 (",round(pca$varprop[1]*100,2),"% )",sep=""))+
ylab(paste("PCA 2 (",round(pca$varprop[2]*100,2),"% )",sep=""))+
scale_colour_manual(name="Location",
values=c(color_med_atl[2],
color_med_atl[1],
color_med_atl[3],
color_med_atl[4]))
p1<-p
p<-ggplot(data=data_pca,aes(x=PC3,y=PC4,label=INDIV))+
theme_minimal()+
theme(panel.grid=element_blank(),
panel.border=element_rect(fill="transparent"),
plot.title=element_text(hjust=0.5))+
geom_hline(yintercept=0,lty=2)+
geom_vline(xintercept=0,lty=2)+
geom_point(size=3,aes(col=LOCA))+
xlab(paste("PCA 3 (",round(pca$varprop[3]*100,2),"% )",sep=""))+
ylab(paste("PCA 4 (",round(pca$varprop[4]*100,2),"% )",sep=""))+
scale_colour_manual(name="Location",
values=c(color_med_atl[2],
color_med_atl[1],
color_med_atl[3],
color_med_atl[4]))
p2<-p
data_varpop=data.frame(PC=factor(paste("P",seq(1,10),sep=""),levels=paste("P",seq(1,10),sep="")),VAR=pca$varprop[1:10])
pp<-ggplot(data_varpop,aes(x=PC,y=VAR))+
geom_bar(stat='identity',fill="dodgerblue2",alpha=0.25)+
theme_classic()+
xlab("Principal Component")+
ylab("Variation explained (%)")
```
```{r}
subplot(ggplotly(p1)%>% layout(legend = list(orientation = "h", x = 0.2, y =-0.15)), ggplotly(p2)%>%hide_legend(), ggplotly(pp)%>%hide_legend(), titleX=T,titleY=T,margin=0.035,widths=c(0.375,0.425,0.2),which_layout=1) %>% partial_bundle()
```
### maf = 0.50
```{r}
pca=PCA_list$All_filtered$maf0.5[[1]]
data_pca=data.frame(INDIV=pca$sample.id,
PC1=pca$eigenvect[,1],
PC2=pca$eigenvect[,2],
PC3=pca$eigenvect[,3],
PC4=pca$eigenvect[,4],
LOCA=c(rep("Algarve",5),
rep("Bay of Biscay",5),
rep("Gulf of Lion",5),
rep("Costa Calida",5)))
color_med_atl=rev(brewer.pal(n=4,name="RdBu"))
p<-ggplot(data=data_pca,aes(x=PC1,y=PC2,label=INDIV))+
theme_minimal()+
theme(panel.grid=element_blank(),
panel.border=element_rect(fill="transparent"),
plot.title=element_text(hjust=0.5))+
geom_hline(yintercept=0,lty=2)+
geom_vline(xintercept=0,lty=2)+
geom_point(size=3,aes(col=LOCA))+
xlab(paste("PCA 1 (",round(pca$varprop[1]*100,2),"% )",sep=""))+
ylab(paste("PCA 2 (",round(pca$varprop[2]*100,2),"% )",sep=""))+
scale_colour_manual(name="Location",
values=c(color_med_atl[2],
color_med_atl[1],
color_med_atl[3],
color_med_atl[4]))
p1<-p
p<-ggplot(data=data_pca,aes(x=PC3,y=PC4,label=INDIV))+
theme_minimal()+
theme(panel.grid=element_blank(),
panel.border=element_rect(fill="transparent"),
plot.title=element_text(hjust=0.5))+
geom_hline(yintercept=0,lty=2)+
geom_vline(xintercept=0,lty=2)+
geom_point(size=3,aes(col=LOCA))+
xlab(paste("PCA 3 (",round(pca$varprop[3]*100,2),"% )",sep=""))+
ylab(paste("PCA 4 (",round(pca$varprop[4]*100,2),"% )",sep=""))+
scale_colour_manual(name="Location",
values=c(color_med_atl[2],
color_med_atl[1],
color_med_atl[3],
color_med_atl[4]))
p2<-p
data_varpop=data.frame(PC=factor(paste("P",seq(1,10),sep=""),levels=paste("P",seq(1,10),sep="")),VAR=pca$varprop[1:10])
pp<-ggplot(data_varpop,aes(x=PC,y=VAR))+
geom_bar(stat='identity',fill="dodgerblue2",alpha=0.25)+
theme_classic()+
xlab("Principal Component")+
ylab("Variation explained (%)")
```
```{r}
subplot(ggplotly(p1)%>% layout(legend = list(orientation = "h", x = 0.2, y =-0.15)), ggplotly(p2)%>%hide_legend(), ggplotly(pp)%>%hide_legend(), titleX=T,titleY=T,margin=0.035,widths=c(0.375,0.425,0.2),which_layout=1) %>% partial_bundle()
```
Row {.tabset data-height=50}
-----------------------
<center>
<font size="6">**Pruned filtered SNPS**</font>
</center>
Row {.tabset data-height=600}
-----------------------
### maf = 0
```{r}
pca=PCA_list$Prune_filtered$maf0[[1]]
data_pca=data.frame(INDIV=pca$sample.id,
PC1=pca$eigenvect[,1],
PC2=pca$eigenvect[,2],
PC3=pca$eigenvect[,3],
PC4=pca$eigenvect[,4],
LOCA=c(rep("Algarve",5),
rep("Bay of Biscay",5),
rep("Gulf of Lion",5),
rep("Costa Calida",5)))
color_med_atl=rev(brewer.pal(n=4,name="RdBu"))
p<-ggplot(data=data_pca,aes(x=PC1,y=PC2,label=INDIV))+
theme_minimal()+
theme(panel.grid=element_blank(),
panel.border=element_rect(fill="transparent"),
plot.title=element_text(hjust=0.5))+
geom_hline(yintercept=0,lty=2)+
geom_vline(xintercept=0,lty=2)+
geom_point(size=3,aes(col=LOCA))+
xlab(paste("PCA 1 (",round(pca$varprop[1]*100,2),"% )",sep=""))+
ylab(paste("PCA 2 (",round(pca$varprop[2]*100,2),"% )",sep=""))+
scale_colour_manual(name="Location",
values=c(color_med_atl[2],
color_med_atl[1],
color_med_atl[3],
color_med_atl[4]))
p1<-p
p<-ggplot(data=data_pca,aes(x=PC3,y=PC4,label=INDIV))+
theme_minimal()+
theme(panel.grid=element_blank(),
panel.border=element_rect(fill="transparent"),
plot.title=element_text(hjust=0.5))+
geom_hline(yintercept=0,lty=2)+
geom_vline(xintercept=0,lty=2)+
geom_point(size=3,aes(col=LOCA))+
xlab(paste("PCA 3 (",round(pca$varprop[3]*100,2),"% )",sep=""))+
ylab(paste("PCA 4 (",round(pca$varprop[4]*100,2),"% )",sep=""))+
scale_colour_manual(name="Location",
values=c(color_med_atl[2],
color_med_atl[1],
color_med_atl[3],
color_med_atl[4]))
p2<-p
data_varpop=data.frame(PC=factor(paste("P",seq(1,10),sep=""),levels=paste("P",seq(1,10),sep="")),VAR=pca$varprop[1:10])
pp<-ggplot(data_varpop,aes(x=PC,y=VAR))+
geom_bar(stat='identity',fill="dodgerblue2",alpha=0.25)+
theme_classic()+
xlab("Principal Component")+
ylab("Variation explained (%)")
```
```{r}
subplot(ggplotly(p1)%>% layout(legend = list(orientation = "h", x = 0.2, y =-0.15)), ggplotly(p2)%>%hide_legend(), ggplotly(pp)%>%hide_legend(), titleX=T,titleY=T,margin=0.035,widths=c(0.375,0.425,0.2),which_layout=1) %>% partial_bundle()
```
### maf = 0.05
```{r}
pca=PCA_list$Prune_filtered$maf0.05[[1]]
data_pca=data.frame(INDIV=pca$sample.id,
PC1=pca$eigenvect[,1],
PC2=pca$eigenvect[,2],
PC3=pca$eigenvect[,3],
PC4=pca$eigenvect[,4],
LOCA=c(rep("Algarve",5),
rep("Bay of Biscay",5),
rep("Gulf of Lion",5),
rep("Costa Calida",5)))
color_med_atl=rev(brewer.pal(n=4,name="RdBu"))
p<-ggplot(data=data_pca,aes(x=PC1,y=PC2,label=INDIV))+
theme_minimal()+
theme(panel.grid=element_blank(),
panel.border=element_rect(fill="transparent"),
plot.title=element_text(hjust=0.5))+
geom_hline(yintercept=0,lty=2)+
geom_vline(xintercept=0,lty=2)+
geom_point(size=3,aes(col=LOCA))+
xlab(paste("PCA 1 (",round(pca$varprop[1]*100,2),"% )",sep=""))+
ylab(paste("PCA 2 (",round(pca$varprop[2]*100,2),"% )",sep=""))+
scale_colour_manual(name="Location",
values=c(color_med_atl[2],
color_med_atl[1],
color_med_atl[3],
color_med_atl[4]))
p1<-p
p<-ggplot(data=data_pca,aes(x=PC3,y=PC4,label=INDIV))+
theme_minimal()+
theme(panel.grid=element_blank(),
panel.border=element_rect(fill="transparent"),
plot.title=element_text(hjust=0.5))+
geom_hline(yintercept=0,lty=2)+
geom_vline(xintercept=0,lty=2)+
geom_point(size=3,aes(col=LOCA))+
xlab(paste("PCA 3 (",round(pca$varprop[3]*100,2),"% )",sep=""))+
ylab(paste("PCA 4 (",round(pca$varprop[4]*100,2),"% )",sep=""))+
scale_colour_manual(name="Location",
values=c(color_med_atl[2],
color_med_atl[1],
color_med_atl[3],
color_med_atl[4]))
p2<-p
data_varpop=data.frame(PC=factor(paste("P",seq(1,10),sep=""),levels=paste("P",seq(1,10),sep="")),VAR=pca$varprop[1:10])
pp<-ggplot(data_varpop,aes(x=PC,y=VAR))+
geom_bar(stat='identity',fill="dodgerblue2",alpha=0.25)+
theme_classic()+
xlab("Principal Component")+
ylab("Variation explained (%)")
```
```{r}
subplot(ggplotly(p1)%>% layout(legend = list(orientation = "h", x = 0.2, y =-0.15)), ggplotly(p2)%>%hide_legend(), ggplotly(pp)%>%hide_legend(), titleX=T,titleY=T,margin=0.035,widths=c(0.375,0.425,0.2),which_layout=1) %>% partial_bundle()
```
### maf = 0.1
```{r}
pca=PCA_list$Prune_filtered$maf0.1[[1]]
data_pca=data.frame(INDIV=pca$sample.id,
PC1=pca$eigenvect[,1],
PC2=pca$eigenvect[,2],
PC3=pca$eigenvect[,3],
PC4=pca$eigenvect[,4],
LOCA=c(rep("Algarve",5),
rep("Bay of Biscay",5),
rep("Gulf of Lion",5),
rep("Costa Calida",5)))
color_med_atl=rev(brewer.pal(n=4,name="RdBu"))
p<-ggplot(data=data_pca,aes(x=PC1,y=PC2,label=INDIV))+
theme_minimal()+
theme(panel.grid=element_blank(),
panel.border=element_rect(fill="transparent"),
plot.title=element_text(hjust=0.5))+
geom_hline(yintercept=0,lty=2)+
geom_vline(xintercept=0,lty=2)+
geom_point(size=3,aes(col=LOCA))+
xlab(paste("PCA 1 (",round(pca$varprop[1]*100,2),"% )",sep=""))+
ylab(paste("PCA 2 (",round(pca$varprop[2]*100,2),"% )",sep=""))+
scale_colour_manual(name="Location",
values=c(color_med_atl[2],
color_med_atl[1],
color_med_atl[3],
color_med_atl[4]))
p1<-p
p<-ggplot(data=data_pca,aes(x=PC3,y=PC4,label=INDIV))+
theme_minimal()+
theme(panel.grid=element_blank(),
panel.border=element_rect(fill="transparent"),
plot.title=element_text(hjust=0.5))+
geom_hline(yintercept=0,lty=2)+
geom_vline(xintercept=0,lty=2)+
geom_point(size=3,aes(col=LOCA))+
xlab(paste("PCA 3 (",round(pca$varprop[3]*100,2),"% )",sep=""))+
ylab(paste("PCA 4 (",round(pca$varprop[4]*100,2),"% )",sep=""))+
scale_colour_manual(name="Location",
values=c(color_med_atl[2],
color_med_atl[1],
color_med_atl[3],
color_med_atl[4]))
p2<-p
data_varpop=data.frame(PC=factor(paste("P",seq(1,10),sep=""),levels=paste("P",seq(1,10),sep="")),VAR=pca$varprop[1:10])
pp<-ggplot(data_varpop,aes(x=PC,y=VAR))+
geom_bar(stat='identity',fill="dodgerblue2",alpha=0.25)+
theme_classic()+
xlab("Principal Component")+
ylab("Variation explained (%)")
```
```{r}
subplot(ggplotly(p1)%>% layout(legend = list(orientation = "h", x = 0.2, y =-0.15)), ggplotly(p2)%>%hide_legend(), ggplotly(pp)%>%hide_legend(), titleX=T,titleY=T,margin=0.035,widths=c(0.375,0.425,0.2),which_layout=1) %>% partial_bundle()
```
### maf = 0.15
```{r}
pca=PCA_list$Prune_filtered$maf0.15[[1]]
data_pca=data.frame(INDIV=pca$sample.id,
PC1=pca$eigenvect[,1],
PC2=pca$eigenvect[,2],
PC3=pca$eigenvect[,3],
PC4=pca$eigenvect[,4],
LOCA=c(rep("Algarve",5),
rep("Bay of Biscay",5),
rep("Gulf of Lion",5),
rep("Costa Calida",5)))
color_med_atl=rev(brewer.pal(n=4,name="RdBu"))
p<-ggplot(data=data_pca,aes(x=PC1,y=PC2,label=INDIV))+
theme_minimal()+
theme(panel.grid=element_blank(),
panel.border=element_rect(fill="transparent"),
plot.title=element_text(hjust=0.5))+
geom_hline(yintercept=0,lty=2)+
geom_vline(xintercept=0,lty=2)+
geom_point(size=3,aes(col=LOCA))+
xlab(paste("PCA 1 (",round(pca$varprop[1]*100,2),"% )",sep=""))+
ylab(paste("PCA 2 (",round(pca$varprop[2]*100,2),"% )",sep=""))+
scale_colour_manual(name="Location",
values=c(color_med_atl[2],
color_med_atl[1],
color_med_atl[3],
color_med_atl[4]))
p1<-p
p<-ggplot(data=data_pca,aes(x=PC3,y=PC4,label=INDIV))+
theme_minimal()+
theme(panel.grid=element_blank(),
panel.border=element_rect(fill="transparent"),
plot.title=element_text(hjust=0.5))+
geom_hline(yintercept=0,lty=2)+
geom_vline(xintercept=0,lty=2)+
geom_point(size=3,aes(col=LOCA))+
xlab(paste("PCA 3 (",round(pca$varprop[3]*100,2),"% )",sep=""))+
ylab(paste("PCA 4 (",round(pca$varprop[4]*100,2),"% )",sep=""))+
scale_colour_manual(name="Location",
values=c(color_med_atl[2],
color_med_atl[1],
color_med_atl[3],
color_med_atl[4]))
p2<-p
data_varpop=data.frame(PC=factor(paste("P",seq(1,10),sep=""),levels=paste("P",seq(1,10),sep="")),VAR=pca$varprop[1:10])
pp<-ggplot(data_varpop,aes(x=PC,y=VAR))+
geom_bar(stat='identity',fill="dodgerblue2",alpha=0.25)+
theme_classic()+
xlab("Principal Component")+
ylab("Variation explained (%)")
```
```{r}
subplot(ggplotly(p1)%>% layout(legend = list(orientation = "h", x = 0.2, y =-0.15)), ggplotly(p2)%>%hide_legend(), ggplotly(pp)%>%hide_legend(), titleX=T,titleY=T,margin=0.035,widths=c(0.375,0.425,0.2),which_layout=1) %>% partial_bundle()
```
### maf = 0.20
```{r}
pca=PCA_list$Prune_filtered$maf0.2[[1]]
data_pca=data.frame(INDIV=pca$sample.id,
PC1=pca$eigenvect[,1],
PC2=pca$eigenvect[,2],
PC3=pca$eigenvect[,3],
PC4=pca$eigenvect[,4],
LOCA=c(rep("Algarve",5),
rep("Bay of Biscay",5),
rep("Gulf of Lion",5),
rep("Costa Calida",5)))
color_med_atl=rev(brewer.pal(n=4,name="RdBu"))
p<-ggplot(data=data_pca,aes(x=PC1,y=PC2,label=INDIV))+
theme_minimal()+
theme(panel.grid=element_blank(),
panel.border=element_rect(fill="transparent"),
plot.title=element_text(hjust=0.5))+
geom_hline(yintercept=0,lty=2)+
geom_vline(xintercept=0,lty=2)+
geom_point(size=3,aes(col=LOCA))+
xlab(paste("PCA 1 (",round(pca$varprop[1]*100,2),"% )",sep=""))+
ylab(paste("PCA 2 (",round(pca$varprop[2]*100,2),"% )",sep=""))+
scale_colour_manual(name="Location",
values=c(color_med_atl[2],
color_med_atl[1],
color_med_atl[3],
color_med_atl[4]))
p1<-p
p<-ggplot(data=data_pca,aes(x=PC3,y=PC4,label=INDIV))+
theme_minimal()+
theme(panel.grid=element_blank(),
panel.border=element_rect(fill="transparent"),
plot.title=element_text(hjust=0.5))+
geom_hline(yintercept=0,lty=2)+
geom_vline(xintercept=0,lty=2)+
geom_point(size=3,aes(col=LOCA))+
xlab(paste("PCA 3 (",round(pca$varprop[3]*100,2),"% )",sep=""))+
ylab(paste("PCA 4 (",round(pca$varprop[4]*100,2),"% )",sep=""))+
scale_colour_manual(name="Location",
values=c(color_med_atl[2],
color_med_atl[1],
color_med_atl[3],
color_med_atl[4]))
p2<-p
data_varpop=data.frame(PC=factor(paste("P",seq(1,10),sep=""),levels=paste("P",seq(1,10),sep="")),VAR=pca$varprop[1:10])
pp<-ggplot(data_varpop,aes(x=PC,y=VAR))+
geom_bar(stat='identity',fill="dodgerblue2",alpha=0.25)+
theme_classic()+
xlab("Principal Component")+
ylab("Variation explained (%)")
```
```{r}
subplot(ggplotly(p1)%>% layout(legend = list(orientation = "h", x = 0.2, y =-0.15)), ggplotly(p2)%>%hide_legend(), ggplotly(pp)%>%hide_legend(), titleX=T,titleY=T,margin=0.035,widths=c(0.375,0.425,0.2),which_layout=1) %>% partial_bundle()
```
### maf = 0.25
```{r}
pca=PCA_list$Prune_filtered$maf0.25[[1]]
data_pca=data.frame(INDIV=pca$sample.id,
PC1=pca$eigenvect[,1],
PC2=pca$eigenvect[,2],
PC3=pca$eigenvect[,3],
PC4=pca$eigenvect[,4],
LOCA=c(rep("Algarve",5),
rep("Bay of Biscay",5),
rep("Gulf of Lion",5),
rep("Costa Calida",5)))
color_med_atl=rev(brewer.pal(n=4,name="RdBu"))
p<-ggplot(data=data_pca,aes(x=PC1,y=PC2,label=INDIV))+
theme_minimal()+
theme(panel.grid=element_blank(),
panel.border=element_rect(fill="transparent"),
plot.title=element_text(hjust=0.5))+
geom_hline(yintercept=0,lty=2)+
geom_vline(xintercept=0,lty=2)+
geom_point(size=3,aes(col=LOCA))+
xlab(paste("PCA 1 (",round(pca$varprop[1]*100,2),"% )",sep=""))+
ylab(paste("PCA 2 (",round(pca$varprop[2]*100,2),"% )",sep=""))+
scale_colour_manual(name="Location",
values=c(color_med_atl[2],
color_med_atl[1],
color_med_atl[3],
color_med_atl[4]))
p1<-p
p<-ggplot(data=data_pca,aes(x=PC3,y=PC4,label=INDIV))+
theme_minimal()+
theme(panel.grid=element_blank(),
panel.border=element_rect(fill="transparent"),
plot.title=element_text(hjust=0.5))+
geom_hline(yintercept=0,lty=2)+
geom_vline(xintercept=0,lty=2)+
geom_point(size=3,aes(col=LOCA))+
xlab(paste("PCA 3 (",round(pca$varprop[3]*100,2),"% )",sep=""))+
ylab(paste("PCA 4 (",round(pca$varprop[4]*100,2),"% )",sep=""))+
scale_colour_manual(name="Location",
values=c(color_med_atl[2],
color_med_atl[1],
color_med_atl[3],
color_med_atl[4]))
p2<-p
data_varpop=data.frame(PC=factor(paste("P",seq(1,10),sep=""),levels=paste("P",seq(1,10),sep="")),VAR=pca$varprop[1:10])
pp<-ggplot(data_varpop,aes(x=PC,y=VAR))+
geom_bar(stat='identity',fill="dodgerblue2",alpha=0.25)+
theme_classic()+
xlab("Principal Component")+
ylab("Variation explained (%)")
```
```{r}
subplot(ggplotly(p1)%>% layout(legend = list(orientation = "h", x = 0.2, y =-0.15)), ggplotly(p2)%>%hide_legend(), ggplotly(pp)%>%hide_legend(), titleX=T,titleY=T,margin=0.035,widths=c(0.375,0.425,0.2),which_layout=1) %>% partial_bundle()
```
### maf = 0.30
```{r}
pca=PCA_list$Prune_filtered$maf0.3[[1]]
data_pca=data.frame(INDIV=pca$sample.id,
PC1=pca$eigenvect[,1],
PC2=pca$eigenvect[,2],
PC3=pca$eigenvect[,3],
PC4=pca$eigenvect[,4],
LOCA=c(rep("Algarve",5),
rep("Bay of Biscay",5),
rep("Gulf of Lion",5),
rep("Costa Calida",5)))
color_med_atl=rev(brewer.pal(n=4,name="RdBu"))
p<-ggplot(data=data_pca,aes(x=PC1,y=PC2,label=INDIV))+
theme_minimal()+
theme(panel.grid=element_blank(),
panel.border=element_rect(fill="transparent"),
plot.title=element_text(hjust=0.5))+
geom_hline(yintercept=0,lty=2)+
geom_vline(xintercept=0,lty=2)+
geom_point(size=3,aes(col=LOCA))+
xlab(paste("PCA 1 (",round(pca$varprop[1]*100,2),"% )",sep=""))+
ylab(paste("PCA 2 (",round(pca$varprop[2]*100,2),"% )",sep=""))+
scale_colour_manual(name="Location",
values=c(color_med_atl[2],
color_med_atl[1],
color_med_atl[3],
color_med_atl[4]))
p1<-p
p<-ggplot(data=data_pca,aes(x=PC3,y=PC4,label=INDIV))+
theme_minimal()+
theme(panel.grid=element_blank(),
panel.border=element_rect(fill="transparent"),
plot.title=element_text(hjust=0.5))+
geom_hline(yintercept=0,lty=2)+
geom_vline(xintercept=0,lty=2)+
geom_point(size=3,aes(col=LOCA))+
xlab(paste("PCA 3 (",round(pca$varprop[3]*100,2),"% )",sep=""))+
ylab(paste("PCA 4 (",round(pca$varprop[4]*100,2),"% )",sep=""))+
scale_colour_manual(name="Location",
values=c(color_med_atl[2],
color_med_atl[1],
color_med_atl[3],
color_med_atl[4]))
p2<-p
data_varpop=data.frame(PC=factor(paste("P",seq(1,10),sep=""),levels=paste("P",seq(1,10),sep="")),VAR=pca$varprop[1:10])
pp<-ggplot(data_varpop,aes(x=PC,y=VAR))+
geom_bar(stat='identity',fill="dodgerblue2",alpha=0.25)+
theme_classic()+
xlab("Principal Component")+
ylab("Variation explained (%)")
```
```{r}
subplot(ggplotly(p1)%>% layout(legend = list(orientation = "h", x = 0.2, y =-0.15)), ggplotly(p2)%>%hide_legend(), ggplotly(pp)%>%hide_legend(), titleX=T,titleY=T,margin=0.035,widths=c(0.375,0.425,0.2),which_layout=1) %>% partial_bundle()
```
### maf = 0.35
```{r}
pca=PCA_list$Prune_filtered$maf0.35[[1]]
data_pca=data.frame(INDIV=pca$sample.id,
PC1=pca$eigenvect[,1],
PC2=pca$eigenvect[,2],
PC3=pca$eigenvect[,3],
PC4=pca$eigenvect[,4],
LOCA=c(rep("Algarve",5),
rep("Bay of Biscay",5),
rep("Gulf of Lion",5),
rep("Costa Calida",5)))
color_med_atl=rev(brewer.pal(n=4,name="RdBu"))
p<-ggplot(data=data_pca,aes(x=PC1,y=PC2,label=INDIV))+
theme_minimal()+
theme(panel.grid=element_blank(),
panel.border=element_rect(fill="transparent"),
plot.title=element_text(hjust=0.5))+
geom_hline(yintercept=0,lty=2)+
geom_vline(xintercept=0,lty=2)+
geom_point(size=3,aes(col=LOCA))+
xlab(paste("PCA 1 (",round(pca$varprop[1]*100,2),"% )",sep=""))+
ylab(paste("PCA 2 (",round(pca$varprop[2]*100,2),"% )",sep=""))+
scale_colour_manual(name="Location",
values=c(color_med_atl[2],
color_med_atl[1],
color_med_atl[3],
color_med_atl[4]))
p1<-p
p<-ggplot(data=data_pca,aes(x=PC3,y=PC4,label=INDIV))+
theme_minimal()+
theme(panel.grid=element_blank(),
panel.border=element_rect(fill="transparent"),
plot.title=element_text(hjust=0.5))+
geom_hline(yintercept=0,lty=2)+
geom_vline(xintercept=0,lty=2)+
geom_point(size=3,aes(col=LOCA))+
xlab(paste("PCA 3 (",round(pca$varprop[3]*100,2),"% )",sep=""))+
ylab(paste("PCA 4 (",round(pca$varprop[4]*100,2),"% )",sep=""))+
scale_colour_manual(name="Location",
values=c(color_med_atl[2],
color_med_atl[1],
color_med_atl[3],
color_med_atl[4]))
p2<-p
data_varpop=data.frame(PC=factor(paste("P",seq(1,10),sep=""),levels=paste("P",seq(1,10),sep="")),VAR=pca$varprop[1:10])
pp<-ggplot(data_varpop,aes(x=PC,y=VAR))+
geom_bar(stat='identity',fill="dodgerblue2",alpha=0.25)+
theme_classic()+
xlab("Principal Component")+
ylab("Variation explained (%)")
```
```{r}
subplot(ggplotly(p1)%>% layout(legend = list(orientation = "h", x = 0.2, y =-0.15)), ggplotly(p2)%>%hide_legend(), ggplotly(pp)%>%hide_legend(), titleX=T,titleY=T,margin=0.035,widths=c(0.375,0.425,0.2),which_layout=1) %>% partial_bundle()
```
### maf = 0.40
```{r}
pca=PCA_list$Prune_filtered$maf0.4[[1]]
data_pca=data.frame(INDIV=pca$sample.id,
PC1=pca$eigenvect[,1],
PC2=pca$eigenvect[,2],
PC3=pca$eigenvect[,3],
PC4=pca$eigenvect[,4],
LOCA=c(rep("Algarve",5),
rep("Bay of Biscay",5),
rep("Gulf of Lion",5),
rep("Costa Calida",5)))
color_med_atl=rev(brewer.pal(n=4,name="RdBu"))
p<-ggplot(data=data_pca,aes(x=PC1,y=PC2,label=INDIV))+
theme_minimal()+
theme(panel.grid=element_blank(),
panel.border=element_rect(fill="transparent"),
plot.title=element_text(hjust=0.5))+
geom_hline(yintercept=0,lty=2)+
geom_vline(xintercept=0,lty=2)+
geom_point(size=3,aes(col=LOCA))+
xlab(paste("PCA 1 (",round(pca$varprop[1]*100,2),"% )",sep=""))+
ylab(paste("PCA 2 (",round(pca$varprop[2]*100,2),"% )",sep=""))+
scale_colour_manual(name="Location",
values=c(color_med_atl[2],
color_med_atl[1],
color_med_atl[3],
color_med_atl[4]))
p1<-p
p<-ggplot(data=data_pca,aes(x=PC3,y=PC4,label=INDIV))+
theme_minimal()+
theme(panel.grid=element_blank(),
panel.border=element_rect(fill="transparent"),
plot.title=element_text(hjust=0.5))+
geom_hline(yintercept=0,lty=2)+
geom_vline(xintercept=0,lty=2)+
geom_point(size=3,aes(col=LOCA))+
xlab(paste("PCA 3 (",round(pca$varprop[3]*100,2),"% )",sep=""))+
ylab(paste("PCA 4 (",round(pca$varprop[4]*100,2),"% )",sep=""))+
scale_colour_manual(name="Location",
values=c(color_med_atl[2],
color_med_atl[1],
color_med_atl[3],
color_med_atl[4]))
p2<-p
data_varpop=data.frame(PC=factor(paste("P",seq(1,10),sep=""),levels=paste("P",seq(1,10),sep="")),VAR=pca$varprop[1:10])
pp<-ggplot(data_varpop,aes(x=PC,y=VAR))+
geom_bar(stat='identity',fill="dodgerblue2",alpha=0.25)+
theme_classic()+
xlab("Principal Component")+
ylab("Variation explained (%)")
```
```{r}
subplot(ggplotly(p1)%>% layout(legend = list(orientation = "h", x = 0.2, y =-0.15)), ggplotly(p2)%>%hide_legend(), ggplotly(pp)%>%hide_legend(), titleX=T,titleY=T,margin=0.035,widths=c(0.375,0.425,0.2),which_layout=1) %>% partial_bundle()
```
### maf = 0.45
```{r}
pca=PCA_list$Prune_filtered$maf0.45[[1]]
data_pca=data.frame(INDIV=pca$sample.id,
PC1=pca$eigenvect[,1],
PC2=pca$eigenvect[,2],
PC3=pca$eigenvect[,3],
PC4=pca$eigenvect[,4],
LOCA=c(rep("Algarve",5),
rep("Bay of Biscay",5),
rep("Gulf of Lion",5),
rep("Costa Calida",5)))
color_med_atl=rev(brewer.pal(n=4,name="RdBu"))
p<-ggplot(data=data_pca,aes(x=PC1,y=PC2,label=INDIV))+
theme_minimal()+
theme(panel.grid=element_blank(),
panel.border=element_rect(fill="transparent"),
plot.title=element_text(hjust=0.5))+
geom_hline(yintercept=0,lty=2)+
geom_vline(xintercept=0,lty=2)+
geom_point(size=3,aes(col=LOCA))+
xlab(paste("PCA 1 (",round(pca$varprop[1]*100,2),"% )",sep=""))+
ylab(paste("PCA 2 (",round(pca$varprop[2]*100,2),"% )",sep=""))+
scale_colour_manual(name="Location",
values=c(color_med_atl[2],
color_med_atl[1],
color_med_atl[3],
color_med_atl[4]))
p1<-p
p<-ggplot(data=data_pca,aes(x=PC3,y=PC4,label=INDIV))+
theme_minimal()+
theme(panel.grid=element_blank(),
panel.border=element_rect(fill="transparent"),
plot.title=element_text(hjust=0.5))+
geom_hline(yintercept=0,lty=2)+
geom_vline(xintercept=0,lty=2)+
geom_point(size=3,aes(col=LOCA))+
xlab(paste("PCA 3 (",round(pca$varprop[3]*100,2),"% )",sep=""))+
ylab(paste("PCA 4 (",round(pca$varprop[4]*100,2),"% )",sep=""))+
scale_colour_manual(name="Location",
values=c(color_med_atl[2],
color_med_atl[1],
color_med_atl[3],
color_med_atl[4]))
p2<-p
data_varpop=data.frame(PC=factor(paste("P",seq(1,10),sep=""),levels=paste("P",seq(1,10),sep="")),VAR=pca$varprop[1:10])
pp<-ggplot(data_varpop,aes(x=PC,y=VAR))+
geom_bar(stat='identity',fill="dodgerblue2",alpha=0.25)+
theme_classic()+
xlab("Principal Component")+
ylab("Variation explained (%)")
```
```{r}
subplot(ggplotly(p1)%>% layout(legend = list(orientation = "h", x = 0.2, y =-0.15)), ggplotly(p2)%>%hide_legend(), ggplotly(pp)%>%hide_legend(), titleX=T,titleY=T,margin=0.035,widths=c(0.375,0.425,0.2),which_layout=1) %>% partial_bundle()
```
### maf = 0.50
```{r}
pca=PCA_list$Prune_filtered$maf0.5[[1]]
data_pca=data.frame(INDIV=pca$sample.id,
PC1=pca$eigenvect[,1],
PC2=pca$eigenvect[,2],
PC3=pca$eigenvect[,3],
PC4=pca$eigenvect[,4],
LOCA=c(rep("Algarve",5),
rep("Bay of Biscay",5),
rep("Gulf of Lion",5),
rep("Costa Calida",5)))
color_med_atl=rev(brewer.pal(n=4,name="RdBu"))
p<-ggplot(data=data_pca,aes(x=PC1,y=PC2,label=INDIV))+
theme_minimal()+
theme(panel.grid=element_blank(),
panel.border=element_rect(fill="transparent"),
plot.title=element_text(hjust=0.5))+
geom_hline(yintercept=0,lty=2)+
geom_vline(xintercept=0,lty=2)+
geom_point(size=3,aes(col=LOCA))+
xlab(paste("PCA 1 (",round(pca$varprop[1]*100,2),"% )",sep=""))+
ylab(paste("PCA 2 (",round(pca$varprop[2]*100,2),"% )",sep=""))+
scale_colour_manual(name="Location",
values=c(color_med_atl[2],
color_med_atl[1],
color_med_atl[3],
color_med_atl[4]))
p1<-p
p<-ggplot(data=data_pca,aes(x=PC3,y=PC4,label=INDIV))+
theme_minimal()+
theme(panel.grid=element_blank(),
panel.border=element_rect(fill="transparent"),
plot.title=element_text(hjust=0.5))+
geom_hline(yintercept=0,lty=2)+
geom_vline(xintercept=0,lty=2)+
geom_point(size=3,aes(col=LOCA))+
xlab(paste("PCA 3 (",round(pca$varprop[3]*100,2),"% )",sep=""))+
ylab(paste("PCA 4 (",round(pca$varprop[4]*100,2),"% )",sep=""))+
scale_colour_manual(name="Location",
values=c(color_med_atl[2],
color_med_atl[1],
color_med_atl[3],
color_med_atl[4]))
p2<-p
data_varpop=data.frame(PC=factor(paste("P",seq(1,10),sep=""),levels=paste("P",seq(1,10),sep="")),VAR=pca$varprop[1:10])
pp<-ggplot(data_varpop,aes(x=PC,y=VAR))+
geom_bar(stat='identity',fill="dodgerblue2",alpha=0.25)+
theme_classic()+
xlab("Principal Component")+
ylab("Variation explained (%)")
```
```{r}
subplot(ggplotly(p1)%>% layout(legend = list(orientation = "h", x = 0.2, y =-0.15)), ggplotly(p2)%>%hide_legend(), ggplotly(pp)%>%hide_legend(), titleX=T,titleY=T,margin=0.035,widths=c(0.375,0.425,0.2),which_layout=1) %>% partial_bundle()
```
Row {.tabset data-height=50}
-----------------------
<center>
<font size="6">**All unfiltered SNPS**</font>
</center>
Row {.tabset data-height=600}
-----------------------
### maf = 0
```{r}
pca=PCA_list$All_unfiltered$maf0[[1]]
data_pca=data.frame(INDIV=pca$sample.id,
PC1=pca$eigenvect[,1],
PC2=pca$eigenvect[,2],
PC3=pca$eigenvect[,3],
PC4=pca$eigenvect[,4],
LOCA=c(rep("Algarve",5),
rep("Bay of Biscay",5),
rep("Gulf of Lion",5),
rep("Costa Calida",5)))
color_med_atl=rev(brewer.pal(n=4,name="RdBu"))
p<-ggplot(data=data_pca,aes(x=PC1,y=PC2,label=INDIV))+
theme_minimal()+
theme(panel.grid=element_blank(),
panel.border=element_rect(fill="transparent"),
plot.title=element_text(hjust=0.5))+
geom_hline(yintercept=0,lty=2)+
geom_vline(xintercept=0,lty=2)+
geom_point(size=3,aes(col=LOCA))+
xlab(paste("PCA 1 (",round(pca$varprop[1]*100,2),"% )",sep=""))+
ylab(paste("PCA 2 (",round(pca$varprop[2]*100,2),"% )",sep=""))+
scale_colour_manual(name="Location",
values=c(color_med_atl[2],
color_med_atl[1],
color_med_atl[3],
color_med_atl[4]))
p1<-p
p<-ggplot(data=data_pca,aes(x=PC3,y=PC4,label=INDIV))+
theme_minimal()+
theme(panel.grid=element_blank(),
panel.border=element_rect(fill="transparent"),
plot.title=element_text(hjust=0.5))+
geom_hline(yintercept=0,lty=2)+
geom_vline(xintercept=0,lty=2)+
geom_point(size=3,aes(col=LOCA))+
xlab(paste("PCA 3 (",round(pca$varprop[3]*100,2),"% )",sep=""))+
ylab(paste("PCA 4 (",round(pca$varprop[4]*100,2),"% )",sep=""))+
scale_colour_manual(name="Location",
values=c(color_med_atl[2],
color_med_atl[1],
color_med_atl[3],
color_med_atl[4]))
p2<-p
data_varpop=data.frame(PC=factor(paste("P",seq(1,10),sep=""),levels=paste("P",seq(1,10),sep="")),VAR=pca$varprop[1:10])
pp<-ggplot(data_varpop,aes(x=PC,y=VAR))+
geom_bar(stat='identity',fill="dodgerblue2",alpha=0.25)+
theme_classic()+
xlab("Principal Component")+
ylab("Variation explained (%)")
```
```{r}
subplot(ggplotly(p1)%>% layout(legend = list(orientation = "h", x = 0.2, y =-0.15)), ggplotly(p2)%>%hide_legend(), ggplotly(pp)%>%hide_legend(), titleX=T,titleY=T,margin=0.035,widths=c(0.375,0.425,0.2),which_layout=1) %>% partial_bundle()
```
### maf = 0.05
```{r}
pca=PCA_list$All_unfiltered$maf0.05[[1]]
data_pca=data.frame(INDIV=pca$sample.id,
PC1=pca$eigenvect[,1],
PC2=pca$eigenvect[,2],
PC3=pca$eigenvect[,3],
PC4=pca$eigenvect[,4],
LOCA=c(rep("Algarve",5),
rep("Bay of Biscay",5),
rep("Gulf of Lion",5),
rep("Costa Calida",5)))
color_med_atl=rev(brewer.pal(n=4,name="RdBu"))
p<-ggplot(data=data_pca,aes(x=PC1,y=PC2,label=INDIV))+
theme_minimal()+
theme(panel.grid=element_blank(),
panel.border=element_rect(fill="transparent"),
plot.title=element_text(hjust=0.5))+
geom_hline(yintercept=0,lty=2)+
geom_vline(xintercept=0,lty=2)+
geom_point(size=3,aes(col=LOCA))+
xlab(paste("PCA 1 (",round(pca$varprop[1]*100,2),"% )",sep=""))+
ylab(paste("PCA 2 (",round(pca$varprop[2]*100,2),"% )",sep=""))+
scale_colour_manual(name="Location",
values=c(color_med_atl[2],
color_med_atl[1],
color_med_atl[3],
color_med_atl[4]))
p1<-p
p<-ggplot(data=data_pca,aes(x=PC3,y=PC4,label=INDIV))+
theme_minimal()+
theme(panel.grid=element_blank(),
panel.border=element_rect(fill="transparent"),
plot.title=element_text(hjust=0.5))+
geom_hline(yintercept=0,lty=2)+
geom_vline(xintercept=0,lty=2)+
geom_point(size=3,aes(col=LOCA))+
xlab(paste("PCA 3 (",round(pca$varprop[3]*100,2),"% )",sep=""))+
ylab(paste("PCA 4 (",round(pca$varprop[4]*100,2),"% )",sep=""))+
scale_colour_manual(name="Location",
values=c(color_med_atl[2],
color_med_atl[1],
color_med_atl[3],
color_med_atl[4]))
p2<-p
data_varpop=data.frame(PC=factor(paste("P",seq(1,10),sep=""),levels=paste("P",seq(1,10),sep="")),VAR=pca$varprop[1:10])
pp<-ggplot(data_varpop,aes(x=PC,y=VAR))+
geom_bar(stat='identity',fill="dodgerblue2",alpha=0.25)+
theme_classic()+
xlab("Principal Component")+
ylab("Variation explained (%)")
```
```{r}
subplot(ggplotly(p1)%>% layout(legend = list(orientation = "h", x = 0.2, y =-0.15)), ggplotly(p2)%>%hide_legend(), ggplotly(pp)%>%hide_legend(), titleX=T,titleY=T,margin=0.035,widths=c(0.375,0.425,0.2),which_layout=1) %>% partial_bundle()
```
### maf = 0.1
```{r}
pca=PCA_list$All_unfiltered$maf0.1[[1]]
data_pca=data.frame(INDIV=pca$sample.id,
PC1=pca$eigenvect[,1],
PC2=pca$eigenvect[,2],
PC3=pca$eigenvect[,3],
PC4=pca$eigenvect[,4],
LOCA=c(rep("Algarve",5),
rep("Bay of Biscay",5),
rep("Gulf of Lion",5),
rep("Costa Calida",5)))
color_med_atl=rev(brewer.pal(n=4,name="RdBu"))
p<-ggplot(data=data_pca,aes(x=PC1,y=PC2,label=INDIV))+
theme_minimal()+
theme(panel.grid=element_blank(),
panel.border=element_rect(fill="transparent"),
plot.title=element_text(hjust=0.5))+
geom_hline(yintercept=0,lty=2)+
geom_vline(xintercept=0,lty=2)+
geom_point(size=3,aes(col=LOCA))+
xlab(paste("PCA 1 (",round(pca$varprop[1]*100,2),"% )",sep=""))+
ylab(paste("PCA 2 (",round(pca$varprop[2]*100,2),"% )",sep=""))+
scale_colour_manual(name="Location",
values=c(color_med_atl[2],
color_med_atl[1],
color_med_atl[3],
color_med_atl[4]))
p1<-p
p<-ggplot(data=data_pca,aes(x=PC3,y=PC4,label=INDIV))+
theme_minimal()+
theme(panel.grid=element_blank(),
panel.border=element_rect(fill="transparent"),
plot.title=element_text(hjust=0.5))+
geom_hline(yintercept=0,lty=2)+
geom_vline(xintercept=0,lty=2)+
geom_point(size=3,aes(col=LOCA))+
xlab(paste("PCA 3 (",round(pca$varprop[3]*100,2),"% )",sep=""))+
ylab(paste("PCA 4 (",round(pca$varprop[4]*100,2),"% )",sep=""))+
scale_colour_manual(name="Location",
values=c(color_med_atl[2],
color_med_atl[1],
color_med_atl[3],
color_med_atl[4]))
p2<-p
data_varpop=data.frame(PC=factor(paste("P",seq(1,10),sep=""),levels=paste("P",seq(1,10),sep="")),VAR=pca$varprop[1:10])
pp<-ggplot(data_varpop,aes(x=PC,y=VAR))+
geom_bar(stat='identity',fill="dodgerblue2",alpha=0.25)+
theme_classic()+
xlab("Principal Component")+
ylab("Variation explained (%)")
```
```{r}
subplot(ggplotly(p1)%>% layout(legend = list(orientation = "h", x = 0.2, y =-0.15)), ggplotly(p2)%>%hide_legend(), ggplotly(pp)%>%hide_legend(), titleX=T,titleY=T,margin=0.035,widths=c(0.375,0.425,0.2),which_layout=1) %>% partial_bundle()
```
### maf = 0.15
```{r}
pca=PCA_list$All_unfiltered$maf0.15[[1]]
data_pca=data.frame(INDIV=pca$sample.id,
PC1=pca$eigenvect[,1],
PC2=pca$eigenvect[,2],
PC3=pca$eigenvect[,3],
PC4=pca$eigenvect[,4],
LOCA=c(rep("Algarve",5),
rep("Bay of Biscay",5),
rep("Gulf of Lion",5),
rep("Costa Calida",5)))
color_med_atl=rev(brewer.pal(n=4,name="RdBu"))
p<-ggplot(data=data_pca,aes(x=PC1,y=PC2,label=INDIV))+
theme_minimal()+
theme(panel.grid=element_blank(),
panel.border=element_rect(fill="transparent"),
plot.title=element_text(hjust=0.5))+
geom_hline(yintercept=0,lty=2)+
geom_vline(xintercept=0,lty=2)+
geom_point(size=3,aes(col=LOCA))+
xlab(paste("PCA 1 (",round(pca$varprop[1]*100,2),"% )",sep=""))+
ylab(paste("PCA 2 (",round(pca$varprop[2]*100,2),"% )",sep=""))+
scale_colour_manual(name="Location",
values=c(color_med_atl[2],
color_med_atl[1],
color_med_atl[3],
color_med_atl[4]))
p1<-p
p<-ggplot(data=data_pca,aes(x=PC3,y=PC4,label=INDIV))+
theme_minimal()+
theme(panel.grid=element_blank(),
panel.border=element_rect(fill="transparent"),
plot.title=element_text(hjust=0.5))+
geom_hline(yintercept=0,lty=2)+
geom_vline(xintercept=0,lty=2)+
geom_point(size=3,aes(col=LOCA))+
xlab(paste("PCA 3 (",round(pca$varprop[3]*100,2),"% )",sep=""))+
ylab(paste("PCA 4 (",round(pca$varprop[4]*100,2),"% )",sep=""))+
scale_colour_manual(name="Location",
values=c(color_med_atl[2],
color_med_atl[1],
color_med_atl[3],
color_med_atl[4]))
p2<-p
data_varpop=data.frame(PC=factor(paste("P",seq(1,10),sep=""),levels=paste("P",seq(1,10),sep="")),VAR=pca$varprop[1:10])
pp<-ggplot(data_varpop,aes(x=PC,y=VAR))+
geom_bar(stat='identity',fill="dodgerblue2",alpha=0.25)+
theme_classic()+
xlab("Principal Component")+
ylab("Variation explained (%)")
```
```{r}
subplot(ggplotly(p1)%>% layout(legend = list(orientation = "h", x = 0.2, y =-0.15)), ggplotly(p2)%>%hide_legend(), ggplotly(pp)%>%hide_legend(), titleX=T,titleY=T,margin=0.035,widths=c(0.375,0.425,0.2),which_layout=1) %>% partial_bundle()
```
### maf = 0.20
```{r}
pca=PCA_list$All_unfiltered$maf0.2[[1]]
data_pca=data.frame(INDIV=pca$sample.id,
PC1=pca$eigenvect[,1],
PC2=pca$eigenvect[,2],
PC3=pca$eigenvect[,3],
PC4=pca$eigenvect[,4],
LOCA=c(rep("Algarve",5),
rep("Bay of Biscay",5),
rep("Gulf of Lion",5),
rep("Costa Calida",5)))
color_med_atl=rev(brewer.pal(n=4,name="RdBu"))
p<-ggplot(data=data_pca,aes(x=PC1,y=PC2,label=INDIV))+
theme_minimal()+
theme(panel.grid=element_blank(),
panel.border=element_rect(fill="transparent"),
plot.title=element_text(hjust=0.5))+
geom_hline(yintercept=0,lty=2)+
geom_vline(xintercept=0,lty=2)+
geom_point(size=3,aes(col=LOCA))+
xlab(paste("PCA 1 (",round(pca$varprop[1]*100,2),"% )",sep=""))+
ylab(paste("PCA 2 (",round(pca$varprop[2]*100,2),"% )",sep=""))+
scale_colour_manual(name="Location",
values=c(color_med_atl[2],
color_med_atl[1],
color_med_atl[3],
color_med_atl[4]))
p1<-p
p<-ggplot(data=data_pca,aes(x=PC3,y=PC4,label=INDIV))+
theme_minimal()+
theme(panel.grid=element_blank(),
panel.border=element_rect(fill="transparent"),
plot.title=element_text(hjust=0.5))+
geom_hline(yintercept=0,lty=2)+
geom_vline(xintercept=0,lty=2)+
geom_point(size=3,aes(col=LOCA))+
xlab(paste("PCA 3 (",round(pca$varprop[3]*100,2),"% )",sep=""))+
ylab(paste("PCA 4 (",round(pca$varprop[4]*100,2),"% )",sep=""))+
scale_colour_manual(name="Location",
values=c(color_med_atl[2],
color_med_atl[1],
color_med_atl[3],
color_med_atl[4]))
p2<-p
data_varpop=data.frame(PC=factor(paste("P",seq(1,10),sep=""),levels=paste("P",seq(1,10),sep="")),VAR=pca$varprop[1:10])
pp<-ggplot(data_varpop,aes(x=PC,y=VAR))+
geom_bar(stat='identity',fill="dodgerblue2",alpha=0.25)+
theme_classic()+
xlab("Principal Component")+
ylab("Variation explained (%)")
```
```{r}
subplot(ggplotly(p1)%>% layout(legend = list(orientation = "h", x = 0.2, y =-0.15)), ggplotly(p2)%>%hide_legend(), ggplotly(pp)%>%hide_legend(), titleX=T,titleY=T,margin=0.035,widths=c(0.375,0.425,0.2),which_layout=1) %>% partial_bundle()
```
### maf = 0.25
```{r}
pca=PCA_list$All_unfiltered$maf0.25[[1]]
data_pca=data.frame(INDIV=pca$sample.id,
PC1=pca$eigenvect[,1],
PC2=pca$eigenvect[,2],
PC3=pca$eigenvect[,3],
PC4=pca$eigenvect[,4],
LOCA=c(rep("Algarve",5),
rep("Bay of Biscay",5),
rep("Gulf of Lion",5),
rep("Costa Calida",5)))
color_med_atl=rev(brewer.pal(n=4,name="RdBu"))
p<-ggplot(data=data_pca,aes(x=PC1,y=PC2,label=INDIV))+
theme_minimal()+
theme(panel.grid=element_blank(),
panel.border=element_rect(fill="transparent"),
plot.title=element_text(hjust=0.5))+
geom_hline(yintercept=0,lty=2)+
geom_vline(xintercept=0,lty=2)+
geom_point(size=3,aes(col=LOCA))+
xlab(paste("PCA 1 (",round(pca$varprop[1]*100,2),"% )",sep=""))+
ylab(paste("PCA 2 (",round(pca$varprop[2]*100,2),"% )",sep=""))+
scale_colour_manual(name="Location",
values=c(color_med_atl[2],
color_med_atl[1],
color_med_atl[3],
color_med_atl[4]))
p1<-p
p<-ggplot(data=data_pca,aes(x=PC3,y=PC4,label=INDIV))+
theme_minimal()+
theme(panel.grid=element_blank(),
panel.border=element_rect(fill="transparent"),
plot.title=element_text(hjust=0.5))+
geom_hline(yintercept=0,lty=2)+
geom_vline(xintercept=0,lty=2)+
geom_point(size=3,aes(col=LOCA))+
xlab(paste("PCA 3 (",round(pca$varprop[3]*100,2),"% )",sep=""))+
ylab(paste("PCA 4 (",round(pca$varprop[4]*100,2),"% )",sep=""))+
scale_colour_manual(name="Location",
values=c(color_med_atl[2],
color_med_atl[1],
color_med_atl[3],
color_med_atl[4]))
p2<-p
data_varpop=data.frame(PC=factor(paste("P",seq(1,10),sep=""),levels=paste("P",seq(1,10),sep="")),VAR=pca$varprop[1:10])
pp<-ggplot(data_varpop,aes(x=PC,y=VAR))+
geom_bar(stat='identity',fill="dodgerblue2",alpha=0.25)+
theme_classic()+
xlab("Principal Component")+
ylab("Variation explained (%)")
```
```{r}
subplot(ggplotly(p1)%>% layout(legend = list(orientation = "h", x = 0.2, y =-0.15)), ggplotly(p2)%>%hide_legend(), ggplotly(pp)%>%hide_legend(), titleX=T,titleY=T,margin=0.035,widths=c(0.375,0.425,0.2),which_layout=1) %>% partial_bundle()
```
### maf = 0.30
```{r}
pca=PCA_list$All_unfiltered$maf0.3[[1]]
data_pca=data.frame(INDIV=pca$sample.id,
PC1=pca$eigenvect[,1],
PC2=pca$eigenvect[,2],
PC3=pca$eigenvect[,3],
PC4=pca$eigenvect[,4],
LOCA=c(rep("Algarve",5),
rep("Bay of Biscay",5),
rep("Gulf of Lion",5),
rep("Costa Calida",5)))
color_med_atl=rev(brewer.pal(n=4,name="RdBu"))
p<-ggplot(data=data_pca,aes(x=PC1,y=PC2,label=INDIV))+
theme_minimal()+
theme(panel.grid=element_blank(),
panel.border=element_rect(fill="transparent"),
plot.title=element_text(hjust=0.5))+
geom_hline(yintercept=0,lty=2)+
geom_vline(xintercept=0,lty=2)+
geom_point(size=3,aes(col=LOCA))+
xlab(paste("PCA 1 (",round(pca$varprop[1]*100,2),"% )",sep=""))+
ylab(paste("PCA 2 (",round(pca$varprop[2]*100,2),"% )",sep=""))+
scale_colour_manual(name="Location",
values=c(color_med_atl[2],
color_med_atl[1],
color_med_atl[3],
color_med_atl[4]))
p1<-p
p<-ggplot(data=data_pca,aes(x=PC3,y=PC4,label=INDIV))+
theme_minimal()+
theme(panel.grid=element_blank(),
panel.border=element_rect(fill="transparent"),
plot.title=element_text(hjust=0.5))+
geom_hline(yintercept=0,lty=2)+
geom_vline(xintercept=0,lty=2)+
geom_point(size=3,aes(col=LOCA))+
xlab(paste("PCA 3 (",round(pca$varprop[3]*100,2),"% )",sep=""))+
ylab(paste("PCA 4 (",round(pca$varprop[4]*100,2),"% )",sep=""))+
scale_colour_manual(name="Location",
values=c(color_med_atl[2],
color_med_atl[1],
color_med_atl[3],
color_med_atl[4]))
p2<-p
data_varpop=data.frame(PC=factor(paste("P",seq(1,10),sep=""),levels=paste("P",seq(1,10),sep="")),VAR=pca$varprop[1:10])
pp<-ggplot(data_varpop,aes(x=PC,y=VAR))+
geom_bar(stat='identity',fill="dodgerblue2",alpha=0.25)+
theme_classic()+
xlab("Principal Component")+
ylab("Variation explained (%)")
```
```{r}
subplot(ggplotly(p1)%>% layout(legend = list(orientation = "h", x = 0.2, y =-0.15)), ggplotly(p2)%>%hide_legend(), ggplotly(pp)%>%hide_legend(), titleX=T,titleY=T,margin=0.035,widths=c(0.375,0.425,0.2),which_layout=1) %>% partial_bundle()
```
### maf = 0.35
```{r}
pca=PCA_list$All_unfiltered$maf0.35[[1]]
data_pca=data.frame(INDIV=pca$sample.id,
PC1=pca$eigenvect[,1],
PC2=pca$eigenvect[,2],
PC3=pca$eigenvect[,3],
PC4=pca$eigenvect[,4],
LOCA=c(rep("Algarve",5),
rep("Bay of Biscay",5),
rep("Gulf of Lion",5),
rep("Costa Calida",5)))
color_med_atl=rev(brewer.pal(n=4,name="RdBu"))
p<-ggplot(data=data_pca,aes(x=PC1,y=PC2,label=INDIV))+
theme_minimal()+
theme(panel.grid=element_blank(),
panel.border=element_rect(fill="transparent"),
plot.title=element_text(hjust=0.5))+
geom_hline(yintercept=0,lty=2)+
geom_vline(xintercept=0,lty=2)+
geom_point(size=3,aes(col=LOCA))+
xlab(paste("PCA 1 (",round(pca$varprop[1]*100,2),"% )",sep=""))+
ylab(paste("PCA 2 (",round(pca$varprop[2]*100,2),"% )",sep=""))+
scale_colour_manual(name="Location",
values=c(color_med_atl[2],
color_med_atl[1],
color_med_atl[3],
color_med_atl[4]))
p1<-p
p<-ggplot(data=data_pca,aes(x=PC3,y=PC4,label=INDIV))+
theme_minimal()+
theme(panel.grid=element_blank(),
panel.border=element_rect(fill="transparent"),
plot.title=element_text(hjust=0.5))+
geom_hline(yintercept=0,lty=2)+
geom_vline(xintercept=0,lty=2)+
geom_point(size=3,aes(col=LOCA))+
xlab(paste("PCA 3 (",round(pca$varprop[3]*100,2),"% )",sep=""))+
ylab(paste("PCA 4 (",round(pca$varprop[4]*100,2),"% )",sep=""))+
scale_colour_manual(name="Location",
values=c(color_med_atl[2],
color_med_atl[1],
color_med_atl[3],
color_med_atl[4]))
p2<-p
data_varpop=data.frame(PC=factor(paste("P",seq(1,10),sep=""),levels=paste("P",seq(1,10),sep="")),VAR=pca$varprop[1:10])
pp<-ggplot(data_varpop,aes(x=PC,y=VAR))+
geom_bar(stat='identity',fill="dodgerblue2",alpha=0.25)+
theme_classic()+
xlab("Principal Component")+
ylab("Variation explained (%)")
```
```{r}
subplot(ggplotly(p1)%>% layout(legend = list(orientation = "h", x = 0.2, y =-0.15)), ggplotly(p2)%>%hide_legend(), ggplotly(pp)%>%hide_legend(), titleX=T,titleY=T,margin=0.035,widths=c(0.375,0.425,0.2),which_layout=1) %>% partial_bundle()
```
### maf = 0.40
```{r}
pca=PCA_list$All_unfiltered$maf0.4[[1]]
data_pca=data.frame(INDIV=pca$sample.id,
PC1=pca$eigenvect[,1],
PC2=pca$eigenvect[,2],
PC3=pca$eigenvect[,3],
PC4=pca$eigenvect[,4],
LOCA=c(rep("Algarve",5),
rep("Bay of Biscay",5),
rep("Gulf of Lion",5),
rep("Costa Calida",5)))
color_med_atl=rev(brewer.pal(n=4,name="RdBu"))
p<-ggplot(data=data_pca,aes(x=PC1,y=PC2,label=INDIV))+
theme_minimal()+
theme(panel.grid=element_blank(),
panel.border=element_rect(fill="transparent"),
plot.title=element_text(hjust=0.5))+
geom_hline(yintercept=0,lty=2)+
geom_vline(xintercept=0,lty=2)+
geom_point(size=3,aes(col=LOCA))+
xlab(paste("PCA 1 (",round(pca$varprop[1]*100,2),"% )",sep=""))+
ylab(paste("PCA 2 (",round(pca$varprop[2]*100,2),"% )",sep=""))+
scale_colour_manual(name="Location",
values=c(color_med_atl[2],
color_med_atl[1],
color_med_atl[3],
color_med_atl[4]))
p1<-p
p<-ggplot(data=data_pca,aes(x=PC3,y=PC4,label=INDIV))+
theme_minimal()+
theme(panel.grid=element_blank(),
panel.border=element_rect(fill="transparent"),
plot.title=element_text(hjust=0.5))+
geom_hline(yintercept=0,lty=2)+
geom_vline(xintercept=0,lty=2)+
geom_point(size=3,aes(col=LOCA))+
xlab(paste("PCA 3 (",round(pca$varprop[3]*100,2),"% )",sep=""))+
ylab(paste("PCA 4 (",round(pca$varprop[4]*100,2),"% )",sep=""))+
scale_colour_manual(name="Location",
values=c(color_med_atl[2],
color_med_atl[1],
color_med_atl[3],
color_med_atl[4]))
p2<-p
data_varpop=data.frame(PC=factor(paste("P",seq(1,10),sep=""),levels=paste("P",seq(1,10),sep="")),VAR=pca$varprop[1:10])
pp<-ggplot(data_varpop,aes(x=PC,y=VAR))+
geom_bar(stat='identity',fill="dodgerblue2",alpha=0.25)+
theme_classic()+
xlab("Principal Component")+
ylab("Variation explained (%)")
```
```{r}
subplot(ggplotly(p1)%>% layout(legend = list(orientation = "h", x = 0.2, y =-0.15)), ggplotly(p2)%>%hide_legend(), ggplotly(pp)%>%hide_legend(), titleX=T,titleY=T,margin=0.035,widths=c(0.375,0.425,0.2),which_layout=1) %>% partial_bundle()
```
### maf = 0.45
```{r}
pca=PCA_list$All_unfiltered$maf0.45[[1]]
data_pca=data.frame(INDIV=pca$sample.id,
PC1=pca$eigenvect[,1],
PC2=pca$eigenvect[,2],
PC3=pca$eigenvect[,3],
PC4=pca$eigenvect[,4],
LOCA=c(rep("Algarve",5),
rep("Bay of Biscay",5),
rep("Gulf of Lion",5),
rep("Costa Calida",5)))
color_med_atl=rev(brewer.pal(n=4,name="RdBu"))
p<-ggplot(data=data_pca,aes(x=PC1,y=PC2,label=INDIV))+
theme_minimal()+
theme(panel.grid=element_blank(),
panel.border=element_rect(fill="transparent"),
plot.title=element_text(hjust=0.5))+
geom_hline(yintercept=0,lty=2)+
geom_vline(xintercept=0,lty=2)+
geom_point(size=3,aes(col=LOCA))+
xlab(paste("PCA 1 (",round(pca$varprop[1]*100,2),"% )",sep=""))+
ylab(paste("PCA 2 (",round(pca$varprop[2]*100,2),"% )",sep=""))+
scale_colour_manual(name="Location",
values=c(color_med_atl[2],
color_med_atl[1],
color_med_atl[3],
color_med_atl[4]))
p1<-p
p<-ggplot(data=data_pca,aes(x=PC3,y=PC4,label=INDIV))+
theme_minimal()+
theme(panel.grid=element_blank(),
panel.border=element_rect(fill="transparent"),
plot.title=element_text(hjust=0.5))+
geom_hline(yintercept=0,lty=2)+
geom_vline(xintercept=0,lty=2)+
geom_point(size=3,aes(col=LOCA))+
xlab(paste("PCA 3 (",round(pca$varprop[3]*100,2),"% )",sep=""))+
ylab(paste("PCA 4 (",round(pca$varprop[4]*100,2),"% )",sep=""))+
scale_colour_manual(name="Location",
values=c(color_med_atl[2],
color_med_atl[1],
color_med_atl[3],
color_med_atl[4]))
p2<-p
data_varpop=data.frame(PC=factor(paste("P",seq(1,10),sep=""),levels=paste("P",seq(1,10),sep="")),VAR=pca$varprop[1:10])
pp<-ggplot(data_varpop,aes(x=PC,y=VAR))+
geom_bar(stat='identity',fill="dodgerblue2",alpha=0.25)+
theme_classic()+
xlab("Principal Component")+
ylab("Variation explained (%)")
```
```{r}
subplot(ggplotly(p1)%>% layout(legend = list(orientation = "h", x = 0.2, y =-0.15)), ggplotly(p2)%>%hide_legend(), ggplotly(pp)%>%hide_legend(), titleX=T,titleY=T,margin=0.035,widths=c(0.375,0.425,0.2),which_layout=1) %>% partial_bundle()
```
### maf = 0.50
```{r}
pca=PCA_list$All_unfiltered$maf0.5[[1]]
data_pca=data.frame(INDIV=pca$sample.id,
PC1=pca$eigenvect[,1],
PC2=pca$eigenvect[,2],
PC3=pca$eigenvect[,3],
PC4=pca$eigenvect[,4],
LOCA=c(rep("Algarve",5),
rep("Bay of Biscay",5),
rep("Gulf of Lion",5),
rep("Costa Calida",5)))
color_med_atl=rev(brewer.pal(n=4,name="RdBu"))
p<-ggplot(data=data_pca,aes(x=PC1,y=PC2,label=INDIV))+
theme_minimal()+
theme(panel.grid=element_blank(),
panel.border=element_rect(fill="transparent"),
plot.title=element_text(hjust=0.5))+
geom_hline(yintercept=0,lty=2)+
geom_vline(xintercept=0,lty=2)+
geom_point(size=3,aes(col=LOCA))+
xlab(paste("PCA 1 (",round(pca$varprop[1]*100,2),"% )",sep=""))+
ylab(paste("PCA 2 (",round(pca$varprop[2]*100,2),"% )",sep=""))+
scale_colour_manual(name="Location",
values=c(color_med_atl[2],
color_med_atl[1],
color_med_atl[3],
color_med_atl[4]))
p1<-p
p<-ggplot(data=data_pca,aes(x=PC3,y=PC4,label=INDIV))+
theme_minimal()+
theme(panel.grid=element_blank(),
panel.border=element_rect(fill="transparent"),
plot.title=element_text(hjust=0.5))+
geom_hline(yintercept=0,lty=2)+
geom_vline(xintercept=0,lty=2)+
geom_point(size=3,aes(col=LOCA))+
xlab(paste("PCA 3 (",round(pca$varprop[3]*100,2),"% )",sep=""))+
ylab(paste("PCA 4 (",round(pca$varprop[4]*100,2),"% )",sep=""))+
scale_colour_manual(name="Location",
values=c(color_med_atl[2],
color_med_atl[1],
color_med_atl[3],
color_med_atl[4]))
p2<-p
data_varpop=data.frame(PC=factor(paste("P",seq(1,10),sep=""),levels=paste("P",seq(1,10),sep="")),VAR=pca$varprop[1:10])
pp<-ggplot(data_varpop,aes(x=PC,y=VAR))+
geom_bar(stat='identity',fill="dodgerblue2",alpha=0.25)+
theme_classic()+
xlab("Principal Component")+
ylab("Variation explained (%)")
```
```{r}
subplot(ggplotly(p1)%>% layout(legend = list(orientation = "h", x = 0.2, y =-0.15)), ggplotly(p2)%>%hide_legend(), ggplotly(pp)%>%hide_legend(), titleX=T,titleY=T,margin=0.035,widths=c(0.375,0.425,0.2),which_layout=1) %>% partial_bundle()
```
Row {.tabset data-height=50}
-----------------------
<center>
<font size="6">**Pruned unfiltered SNPS**</font>
</center>
Row {.tabset data-height=600}
-----------------------
### maf = 0
```{r}
pca=PCA_list$Prune_unfiltered$maf0[[1]]
data_pca=data.frame(INDIV=pca$sample.id,
PC1=pca$eigenvect[,1],
PC2=pca$eigenvect[,2],
PC3=pca$eigenvect[,3],
PC4=pca$eigenvect[,4],
LOCA=c(rep("Algarve",5),
rep("Bay of Biscay",5),
rep("Gulf of Lion",5),
rep("Costa Calida",5)))
color_med_atl=rev(brewer.pal(n=4,name="RdBu"))
p<-ggplot(data=data_pca,aes(x=PC1,y=PC2,label=INDIV))+
theme_minimal()+
theme(panel.grid=element_blank(),
panel.border=element_rect(fill="transparent"),
plot.title=element_text(hjust=0.5))+
geom_hline(yintercept=0,lty=2)+
geom_vline(xintercept=0,lty=2)+
geom_point(size=3,aes(col=LOCA))+
xlab(paste("PCA 1 (",round(pca$varprop[1]*100,2),"% )",sep=""))+
ylab(paste("PCA 2 (",round(pca$varprop[2]*100,2),"% )",sep=""))+
scale_colour_manual(name="Location",
values=c(color_med_atl[2],
color_med_atl[1],
color_med_atl[3],
color_med_atl[4]))
p1<-p
p<-ggplot(data=data_pca,aes(x=PC3,y=PC4,label=INDIV))+
theme_minimal()+
theme(panel.grid=element_blank(),
panel.border=element_rect(fill="transparent"),
plot.title=element_text(hjust=0.5))+
geom_hline(yintercept=0,lty=2)+
geom_vline(xintercept=0,lty=2)+
geom_point(size=3,aes(col=LOCA))+
xlab(paste("PCA 3 (",round(pca$varprop[3]*100,2),"% )",sep=""))+
ylab(paste("PCA 4 (",round(pca$varprop[4]*100,2),"% )",sep=""))+
scale_colour_manual(name="Location",
values=c(color_med_atl[2],
color_med_atl[1],
color_med_atl[3],
color_med_atl[4]))
p2<-p
data_varpop=data.frame(PC=factor(paste("P",seq(1,10),sep=""),levels=paste("P",seq(1,10),sep="")),VAR=pca$varprop[1:10])
pp<-ggplot(data_varpop,aes(x=PC,y=VAR))+
geom_bar(stat='identity',fill="dodgerblue2",alpha=0.25)+
theme_classic()+
xlab("Principal Component")+
ylab("Variation explained (%)")
```
```{r}
subplot(ggplotly(p1)%>% layout(legend = list(orientation = "h", x = 0.2, y =-0.15)), ggplotly(p2)%>%hide_legend(), ggplotly(pp)%>%hide_legend(), titleX=T,titleY=T,margin=0.035,widths=c(0.375,0.425,0.2),which_layout=1) %>% partial_bundle()
```
### maf = 0.05
```{r}
pca=PCA_list$Prune_unfiltered$maf0.05[[1]]
data_pca=data.frame(INDIV=pca$sample.id,
PC1=pca$eigenvect[,1],
PC2=pca$eigenvect[,2],
PC3=pca$eigenvect[,3],
PC4=pca$eigenvect[,4],
LOCA=c(rep("Algarve",5),
rep("Bay of Biscay",5),
rep("Gulf of Lion",5),
rep("Costa Calida",5)))
color_med_atl=rev(brewer.pal(n=4,name="RdBu"))
p<-ggplot(data=data_pca,aes(x=PC1,y=PC2,label=INDIV))+
theme_minimal()+
theme(panel.grid=element_blank(),
panel.border=element_rect(fill="transparent"),
plot.title=element_text(hjust=0.5))+
geom_hline(yintercept=0,lty=2)+
geom_vline(xintercept=0,lty=2)+
geom_point(size=3,aes(col=LOCA))+
xlab(paste("PCA 1 (",round(pca$varprop[1]*100,2),"% )",sep=""))+
ylab(paste("PCA 2 (",round(pca$varprop[2]*100,2),"% )",sep=""))+
scale_colour_manual(name="Location",
values=c(color_med_atl[2],
color_med_atl[1],
color_med_atl[3],
color_med_atl[4]))
p1<-p
p<-ggplot(data=data_pca,aes(x=PC3,y=PC4,label=INDIV))+
theme_minimal()+
theme(panel.grid=element_blank(),
panel.border=element_rect(fill="transparent"),
plot.title=element_text(hjust=0.5))+
geom_hline(yintercept=0,lty=2)+
geom_vline(xintercept=0,lty=2)+
geom_point(size=3,aes(col=LOCA))+
xlab(paste("PCA 3 (",round(pca$varprop[3]*100,2),"% )",sep=""))+
ylab(paste("PCA 4 (",round(pca$varprop[4]*100,2),"% )",sep=""))+
scale_colour_manual(name="Location",
values=c(color_med_atl[2],
color_med_atl[1],
color_med_atl[3],
color_med_atl[4]))
p2<-p
data_varpop=data.frame(PC=factor(paste("P",seq(1,10),sep=""),levels=paste("P",seq(1,10),sep="")),VAR=pca$varprop[1:10])
pp<-ggplot(data_varpop,aes(x=PC,y=VAR))+
geom_bar(stat='identity',fill="dodgerblue2",alpha=0.25)+
theme_classic()+
xlab("Principal Component")+
ylab("Variation explained (%)")
```
```{r}
subplot(ggplotly(p1)%>% layout(legend = list(orientation = "h", x = 0.2, y =-0.15)), ggplotly(p2)%>%hide_legend(), ggplotly(pp)%>%hide_legend(), titleX=T,titleY=T,margin=0.035,widths=c(0.375,0.425,0.2),which_layout=1) %>% partial_bundle()
```
### maf = 0.1
```{r}
pca=PCA_list$Prune_unfiltered$maf0.1[[1]]
data_pca=data.frame(INDIV=pca$sample.id,
PC1=pca$eigenvect[,1],
PC2=pca$eigenvect[,2],
PC3=pca$eigenvect[,3],
PC4=pca$eigenvect[,4],
LOCA=c(rep("Algarve",5),
rep("Bay of Biscay",5),
rep("Gulf of Lion",5),
rep("Costa Calida",5)))
color_med_atl=rev(brewer.pal(n=4,name="RdBu"))
p<-ggplot(data=data_pca,aes(x=PC1,y=PC2,label=INDIV))+
theme_minimal()+
theme(panel.grid=element_blank(),
panel.border=element_rect(fill="transparent"),
plot.title=element_text(hjust=0.5))+
geom_hline(yintercept=0,lty=2)+
geom_vline(xintercept=0,lty=2)+
geom_point(size=3,aes(col=LOCA))+
xlab(paste("PCA 1 (",round(pca$varprop[1]*100,2),"% )",sep=""))+
ylab(paste("PCA 2 (",round(pca$varprop[2]*100,2),"% )",sep=""))+
scale_colour_manual(name="Location",
values=c(color_med_atl[2],
color_med_atl[1],
color_med_atl[3],
color_med_atl[4]))
p1<-p
p<-ggplot(data=data_pca,aes(x=PC3,y=PC4,label=INDIV))+
theme_minimal()+
theme(panel.grid=element_blank(),
panel.border=element_rect(fill="transparent"),
plot.title=element_text(hjust=0.5))+
geom_hline(yintercept=0,lty=2)+
geom_vline(xintercept=0,lty=2)+
geom_point(size=3,aes(col=LOCA))+
xlab(paste("PCA 3 (",round(pca$varprop[3]*100,2),"% )",sep=""))+
ylab(paste("PCA 4 (",round(pca$varprop[4]*100,2),"% )",sep=""))+
scale_colour_manual(name="Location",
values=c(color_med_atl[2],
color_med_atl[1],
color_med_atl[3],
color_med_atl[4]))
p2<-p
data_varpop=data.frame(PC=factor(paste("P",seq(1,10),sep=""),levels=paste("P",seq(1,10),sep="")),VAR=pca$varprop[1:10])
pp<-ggplot(data_varpop,aes(x=PC,y=VAR))+
geom_bar(stat='identity',fill="dodgerblue2",alpha=0.25)+
theme_classic()+
xlab("Principal Component")+
ylab("Variation explained (%)")
```
```{r}
subplot(ggplotly(p1)%>% layout(legend = list(orientation = "h", x = 0.2, y =-0.15)), ggplotly(p2)%>%hide_legend(), ggplotly(pp)%>%hide_legend(), titleX=T,titleY=T,margin=0.035,widths=c(0.375,0.425,0.2),which_layout=1) %>% partial_bundle()
```
### maf = 0.15
```{r}
pca=PCA_list$Prune_unfiltered$maf0.15[[1]]
data_pca=data.frame(INDIV=pca$sample.id,
PC1=pca$eigenvect[,1],
PC2=pca$eigenvect[,2],
PC3=pca$eigenvect[,3],
PC4=pca$eigenvect[,4],
LOCA=c(rep("Algarve",5),
rep("Bay of Biscay",5),
rep("Gulf of Lion",5),
rep("Costa Calida",5)))
color_med_atl=rev(brewer.pal(n=4,name="RdBu"))
p<-ggplot(data=data_pca,aes(x=PC1,y=PC2,label=INDIV))+
theme_minimal()+
theme(panel.grid=element_blank(),
panel.border=element_rect(fill="transparent"),
plot.title=element_text(hjust=0.5))+
geom_hline(yintercept=0,lty=2)+
geom_vline(xintercept=0,lty=2)+
geom_point(size=3,aes(col=LOCA))+
xlab(paste("PCA 1 (",round(pca$varprop[1]*100,2),"% )",sep=""))+
ylab(paste("PCA 2 (",round(pca$varprop[2]*100,2),"% )",sep=""))+
scale_colour_manual(name="Location",
values=c(color_med_atl[2],
color_med_atl[1],
color_med_atl[3],
color_med_atl[4]))
p1<-p
p<-ggplot(data=data_pca,aes(x=PC3,y=PC4,label=INDIV))+
theme_minimal()+
theme(panel.grid=element_blank(),
panel.border=element_rect(fill="transparent"),
plot.title=element_text(hjust=0.5))+
geom_hline(yintercept=0,lty=2)+
geom_vline(xintercept=0,lty=2)+
geom_point(size=3,aes(col=LOCA))+
xlab(paste("PCA 3 (",round(pca$varprop[3]*100,2),"% )",sep=""))+
ylab(paste("PCA 4 (",round(pca$varprop[4]*100,2),"% )",sep=""))+
scale_colour_manual(name="Location",
values=c(color_med_atl[2],
color_med_atl[1],
color_med_atl[3],
color_med_atl[4]))
p2<-p
data_varpop=data.frame(PC=factor(paste("P",seq(1,10),sep=""),levels=paste("P",seq(1,10),sep="")),VAR=pca$varprop[1:10])
pp<-ggplot(data_varpop,aes(x=PC,y=VAR))+
geom_bar(stat='identity',fill="dodgerblue2",alpha=0.25)+
theme_classic()+
xlab("Principal Component")+
ylab("Variation explained (%)")
```
```{r}
subplot(ggplotly(p1)%>% layout(legend = list(orientation = "h", x = 0.2, y =-0.15)), ggplotly(p2)%>%hide_legend(), ggplotly(pp)%>%hide_legend(), titleX=T,titleY=T,margin=0.035,widths=c(0.375,0.425,0.2),which_layout=1) %>% partial_bundle()
```
### maf = 0.20
```{r}
pca=PCA_list$Prune_unfiltered$maf0.2[[1]]
data_pca=data.frame(INDIV=pca$sample.id,
PC1=pca$eigenvect[,1],
PC2=pca$eigenvect[,2],
PC3=pca$eigenvect[,3],
PC4=pca$eigenvect[,4],
LOCA=c(rep("Algarve",5),
rep("Bay of Biscay",5),
rep("Gulf of Lion",5),
rep("Costa Calida",5)))
color_med_atl=rev(brewer.pal(n=4,name="RdBu"))
p<-ggplot(data=data_pca,aes(x=PC1,y=PC2,label=INDIV))+
theme_minimal()+
theme(panel.grid=element_blank(),
panel.border=element_rect(fill="transparent"),
plot.title=element_text(hjust=0.5))+
geom_hline(yintercept=0,lty=2)+
geom_vline(xintercept=0,lty=2)+
geom_point(size=3,aes(col=LOCA))+
xlab(paste("PCA 1 (",round(pca$varprop[1]*100,2),"% )",sep=""))+
ylab(paste("PCA 2 (",round(pca$varprop[2]*100,2),"% )",sep=""))+
scale_colour_manual(name="Location",
values=c(color_med_atl[2],
color_med_atl[1],
color_med_atl[3],
color_med_atl[4]))
p1<-p
p<-ggplot(data=data_pca,aes(x=PC3,y=PC4,label=INDIV))+
theme_minimal()+
theme(panel.grid=element_blank(),
panel.border=element_rect(fill="transparent"),
plot.title=element_text(hjust=0.5))+
geom_hline(yintercept=0,lty=2)+
geom_vline(xintercept=0,lty=2)+
geom_point(size=3,aes(col=LOCA))+
xlab(paste("PCA 3 (",round(pca$varprop[3]*100,2),"% )",sep=""))+
ylab(paste("PCA 4 (",round(pca$varprop[4]*100,2),"% )",sep=""))+
scale_colour_manual(name="Location",
values=c(color_med_atl[2],
color_med_atl[1],
color_med_atl[3],
color_med_atl[4]))
p2<-p
data_varpop=data.frame(PC=factor(paste("P",seq(1,10),sep=""),levels=paste("P",seq(1,10),sep="")),VAR=pca$varprop[1:10])
pp<-ggplot(data_varpop,aes(x=PC,y=VAR))+
geom_bar(stat='identity',fill="dodgerblue2",alpha=0.25)+
theme_classic()+
xlab("Principal Component")+
ylab("Variation explained (%)")
```
```{r}
subplot(ggplotly(p1)%>% layout(legend = list(orientation = "h", x = 0.2, y =-0.15)), ggplotly(p2)%>%hide_legend(), ggplotly(pp)%>%hide_legend(), titleX=T,titleY=T,margin=0.035,widths=c(0.375,0.425,0.2),which_layout=1) %>% partial_bundle()
```
### maf = 0.25
```{r}
pca=PCA_list$Prune_unfiltered$maf0.25[[1]]
data_pca=data.frame(INDIV=pca$sample.id,
PC1=pca$eigenvect[,1],
PC2=pca$eigenvect[,2],
PC3=pca$eigenvect[,3],
PC4=pca$eigenvect[,4],
LOCA=c(rep("Algarve",5),
rep("Bay of Biscay",5),
rep("Gulf of Lion",5),
rep("Costa Calida",5)))
color_med_atl=rev(brewer.pal(n=4,name="RdBu"))
p<-ggplot(data=data_pca,aes(x=PC1,y=PC2,label=INDIV))+
theme_minimal()+
theme(panel.grid=element_blank(),
panel.border=element_rect(fill="transparent"),
plot.title=element_text(hjust=0.5))+
geom_hline(yintercept=0,lty=2)+
geom_vline(xintercept=0,lty=2)+
geom_point(size=3,aes(col=LOCA))+
xlab(paste("PCA 1 (",round(pca$varprop[1]*100,2),"% )",sep=""))+
ylab(paste("PCA 2 (",round(pca$varprop[2]*100,2),"% )",sep=""))+
scale_colour_manual(name="Location",
values=c(color_med_atl[2],
color_med_atl[1],
color_med_atl[3],
color_med_atl[4]))
p1<-p
p<-ggplot(data=data_pca,aes(x=PC3,y=PC4,label=INDIV))+
theme_minimal()+
theme(panel.grid=element_blank(),
panel.border=element_rect(fill="transparent"),
plot.title=element_text(hjust=0.5))+
geom_hline(yintercept=0,lty=2)+
geom_vline(xintercept=0,lty=2)+
geom_point(size=3,aes(col=LOCA))+
xlab(paste("PCA 3 (",round(pca$varprop[3]*100,2),"% )",sep=""))+
ylab(paste("PCA 4 (",round(pca$varprop[4]*100,2),"% )",sep=""))+
scale_colour_manual(name="Location",
values=c(color_med_atl[2],
color_med_atl[1],
color_med_atl[3],
color_med_atl[4]))
p2<-p
data_varpop=data.frame(PC=factor(paste("P",seq(1,10),sep=""),levels=paste("P",seq(1,10),sep="")),VAR=pca$varprop[1:10])
pp<-ggplot(data_varpop,aes(x=PC,y=VAR))+
geom_bar(stat='identity',fill="dodgerblue2",alpha=0.25)+
theme_classic()+
xlab("Principal Component")+
ylab("Variation explained (%)")
```
```{r}
subplot(ggplotly(p1)%>% layout(legend = list(orientation = "h", x = 0.2, y =-0.15)), ggplotly(p2)%>%hide_legend(), ggplotly(pp)%>%hide_legend(), titleX=T,titleY=T,margin=0.035,widths=c(0.375,0.425,0.2),which_layout=1) %>% partial_bundle()
```
### maf = 0.30
```{r}
pca=PCA_list$Prune_unfiltered$maf0.3[[1]]
data_pca=data.frame(INDIV=pca$sample.id,
PC1=pca$eigenvect[,1],
PC2=pca$eigenvect[,2],
PC3=pca$eigenvect[,3],
PC4=pca$eigenvect[,4],
LOCA=c(rep("Algarve",5),
rep("Bay of Biscay",5),
rep("Gulf of Lion",5),
rep("Costa Calida",5)))
color_med_atl=rev(brewer.pal(n=4,name="RdBu"))
p<-ggplot(data=data_pca,aes(x=PC1,y=PC2,label=INDIV))+
theme_minimal()+
theme(panel.grid=element_blank(),
panel.border=element_rect(fill="transparent"),
plot.title=element_text(hjust=0.5))+
geom_hline(yintercept=0,lty=2)+
geom_vline(xintercept=0,lty=2)+
geom_point(size=3,aes(col=LOCA))+
xlab(paste("PCA 1 (",round(pca$varprop[1]*100,2),"% )",sep=""))+
ylab(paste("PCA 2 (",round(pca$varprop[2]*100,2),"% )",sep=""))+
scale_colour_manual(name="Location",
values=c(color_med_atl[2],
color_med_atl[1],
color_med_atl[3],
color_med_atl[4]))
p1<-p
p<-ggplot(data=data_pca,aes(x=PC3,y=PC4,label=INDIV))+
theme_minimal()+
theme(panel.grid=element_blank(),
panel.border=element_rect(fill="transparent"),
plot.title=element_text(hjust=0.5))+
geom_hline(yintercept=0,lty=2)+
geom_vline(xintercept=0,lty=2)+
geom_point(size=3,aes(col=LOCA))+
xlab(paste("PCA 3 (",round(pca$varprop[3]*100,2),"% )",sep=""))+
ylab(paste("PCA 4 (",round(pca$varprop[4]*100,2),"% )",sep=""))+
scale_colour_manual(name="Location",
values=c(color_med_atl[2],
color_med_atl[1],
color_med_atl[3],
color_med_atl[4]))
p2<-p
data_varpop=data.frame(PC=factor(paste("P",seq(1,10),sep=""),levels=paste("P",seq(1,10),sep="")),VAR=pca$varprop[1:10])
pp<-ggplot(data_varpop,aes(x=PC,y=VAR))+
geom_bar(stat='identity',fill="dodgerblue2",alpha=0.25)+
theme_classic()+
xlab("Principal Component")+
ylab("Variation explained (%)")
```
```{r}
subplot(ggplotly(p1)%>% layout(legend = list(orientation = "h", x = 0.2, y =-0.15)), ggplotly(p2)%>%hide_legend(), ggplotly(pp)%>%hide_legend(), titleX=T,titleY=T,margin=0.035,widths=c(0.375,0.425,0.2),which_layout=1) %>% partial_bundle()
```
### maf = 0.35
```{r}
pca=PCA_list$Prune_unfiltered$maf0.35[[1]]
data_pca=data.frame(INDIV=pca$sample.id,
PC1=pca$eigenvect[,1],
PC2=pca$eigenvect[,2],
PC3=pca$eigenvect[,3],
PC4=pca$eigenvect[,4],
LOCA=c(rep("Algarve",5),
rep("Bay of Biscay",5),
rep("Gulf of Lion",5),
rep("Costa Calida",5)))
color_med_atl=rev(brewer.pal(n=4,name="RdBu"))
p<-ggplot(data=data_pca,aes(x=PC1,y=PC2,label=INDIV))+
theme_minimal()+
theme(panel.grid=element_blank(),
panel.border=element_rect(fill="transparent"),
plot.title=element_text(hjust=0.5))+
geom_hline(yintercept=0,lty=2)+
geom_vline(xintercept=0,lty=2)+
geom_point(size=3,aes(col=LOCA))+
xlab(paste("PCA 1 (",round(pca$varprop[1]*100,2),"% )",sep=""))+
ylab(paste("PCA 2 (",round(pca$varprop[2]*100,2),"% )",sep=""))+
scale_colour_manual(name="Location",
values=c(color_med_atl[2],
color_med_atl[1],
color_med_atl[3],
color_med_atl[4]))
p1<-p
p<-ggplot(data=data_pca,aes(x=PC3,y=PC4,label=INDIV))+
theme_minimal()+
theme(panel.grid=element_blank(),
panel.border=element_rect(fill="transparent"),
plot.title=element_text(hjust=0.5))+
geom_hline(yintercept=0,lty=2)+
geom_vline(xintercept=0,lty=2)+
geom_point(size=3,aes(col=LOCA))+
xlab(paste("PCA 3 (",round(pca$varprop[3]*100,2),"% )",sep=""))+
ylab(paste("PCA 4 (",round(pca$varprop[4]*100,2),"% )",sep=""))+
scale_colour_manual(name="Location",
values=c(color_med_atl[2],
color_med_atl[1],
color_med_atl[3],
color_med_atl[4]))
p2<-p
data_varpop=data.frame(PC=factor(paste("P",seq(1,10),sep=""),levels=paste("P",seq(1,10),sep="")),VAR=pca$varprop[1:10])
pp<-ggplot(data_varpop,aes(x=PC,y=VAR))+
geom_bar(stat='identity',fill="dodgerblue2",alpha=0.25)+
theme_classic()+
xlab("Principal Component")+
ylab("Variation explained (%)")
```
```{r}
subplot(ggplotly(p1)%>% layout(legend = list(orientation = "h", x = 0.2, y =-0.15)), ggplotly(p2)%>%hide_legend(), ggplotly(pp)%>%hide_legend(), titleX=T,titleY=T,margin=0.035,widths=c(0.375,0.425,0.2),which_layout=1) %>% partial_bundle()
```
### maf = 0.40
```{r}
pca=PCA_list$Prune_unfiltered$maf0.4[[1]]
data_pca=data.frame(INDIV=pca$sample.id,
PC1=pca$eigenvect[,1],
PC2=pca$eigenvect[,2],
PC3=pca$eigenvect[,3],
PC4=pca$eigenvect[,4],
LOCA=c(rep("Algarve",5),
rep("Bay of Biscay",5),
rep("Gulf of Lion",5),
rep("Costa Calida",5)))
color_med_atl=rev(brewer.pal(n=4,name="RdBu"))
p<-ggplot(data=data_pca,aes(x=PC1,y=PC2,label=INDIV))+
theme_minimal()+
theme(panel.grid=element_blank(),
panel.border=element_rect(fill="transparent"),
plot.title=element_text(hjust=0.5))+
geom_hline(yintercept=0,lty=2)+
geom_vline(xintercept=0,lty=2)+
geom_point(size=3,aes(col=LOCA))+
xlab(paste("PCA 1 (",round(pca$varprop[1]*100,2),"% )",sep=""))+
ylab(paste("PCA 2 (",round(pca$varprop[2]*100,2),"% )",sep=""))+
scale_colour_manual(name="Location",
values=c(color_med_atl[2],
color_med_atl[1],
color_med_atl[3],
color_med_atl[4]))
p1<-p
p<-ggplot(data=data_pca,aes(x=PC3,y=PC4,label=INDIV))+
theme_minimal()+
theme(panel.grid=element_blank(),
panel.border=element_rect(fill="transparent"),
plot.title=element_text(hjust=0.5))+
geom_hline(yintercept=0,lty=2)+
geom_vline(xintercept=0,lty=2)+
geom_point(size=3,aes(col=LOCA))+
xlab(paste("PCA 3 (",round(pca$varprop[3]*100,2),"% )",sep=""))+
ylab(paste("PCA 4 (",round(pca$varprop[4]*100,2),"% )",sep=""))+
scale_colour_manual(name="Location",
values=c(color_med_atl[2],
color_med_atl[1],
color_med_atl[3],
color_med_atl[4]))
p2<-p
data_varpop=data.frame(PC=factor(paste("P",seq(1,10),sep=""),levels=paste("P",seq(1,10),sep="")),VAR=pca$varprop[1:10])
pp<-ggplot(data_varpop,aes(x=PC,y=VAR))+
geom_bar(stat='identity',fill="dodgerblue2",alpha=0.25)+
theme_classic()+
xlab("Principal Component")+
ylab("Variation explained (%)")
```
```{r}
subplot(ggplotly(p1)%>% layout(legend = list(orientation = "h", x = 0.2, y =-0.15)), ggplotly(p2)%>%hide_legend(), ggplotly(pp)%>%hide_legend(), titleX=T,titleY=T,margin=0.035,widths=c(0.375,0.425,0.2),which_layout=1) %>% partial_bundle()
```
### maf = 0.45
```{r}
pca=PCA_list$Prune_unfiltered$maf0.45[[1]]
data_pca=data.frame(INDIV=pca$sample.id,
PC1=pca$eigenvect[,1],
PC2=pca$eigenvect[,2],
PC3=pca$eigenvect[,3],
PC4=pca$eigenvect[,4],
LOCA=c(rep("Algarve",5),
rep("Bay of Biscay",5),
rep("Gulf of Lion",5),
rep("Costa Calida",5)))
color_med_atl=rev(brewer.pal(n=4,name="RdBu"))
p<-ggplot(data=data_pca,aes(x=PC1,y=PC2,label=INDIV))+
theme_minimal()+
theme(panel.grid=element_blank(),
panel.border=element_rect(fill="transparent"),
plot.title=element_text(hjust=0.5))+
geom_hline(yintercept=0,lty=2)+
geom_vline(xintercept=0,lty=2)+
geom_point(size=3,aes(col=LOCA))+
xlab(paste("PCA 1 (",round(pca$varprop[1]*100,2),"% )",sep=""))+
ylab(paste("PCA 2 (",round(pca$varprop[2]*100,2),"% )",sep=""))+
scale_colour_manual(name="Location",
values=c(color_med_atl[2],
color_med_atl[1],
color_med_atl[3],
color_med_atl[4]))
p1<-p
p<-ggplot(data=data_pca,aes(x=PC3,y=PC4,label=INDIV))+
theme_minimal()+
theme(panel.grid=element_blank(),
panel.border=element_rect(fill="transparent"),
plot.title=element_text(hjust=0.5))+
geom_hline(yintercept=0,lty=2)+
geom_vline(xintercept=0,lty=2)+
geom_point(size=3,aes(col=LOCA))+
xlab(paste("PCA 3 (",round(pca$varprop[3]*100,2),"% )",sep=""))+
ylab(paste("PCA 4 (",round(pca$varprop[4]*100,2),"% )",sep=""))+
scale_colour_manual(name="Location",
values=c(color_med_atl[2],
color_med_atl[1],
color_med_atl[3],
color_med_atl[4]))
p2<-p
data_varpop=data.frame(PC=factor(paste("P",seq(1,10),sep=""),levels=paste("P",seq(1,10),sep="")),VAR=pca$varprop[1:10])
pp<-ggplot(data_varpop,aes(x=PC,y=VAR))+
geom_bar(stat='identity',fill="dodgerblue2",alpha=0.25)+
theme_classic()+
xlab("Principal Component")+
ylab("Variation explained (%)")
```
```{r}
subplot(ggplotly(p1)%>% layout(legend = list(orientation = "h", x = 0.2, y =-0.15)), ggplotly(p2)%>%hide_legend(), ggplotly(pp)%>%hide_legend(), titleX=T,titleY=T,margin=0.035,widths=c(0.375,0.425,0.2),which_layout=1) %>% partial_bundle()
```
### maf = 0.50
```{r}
pca=PCA_list$Prune_unfiltered$maf0.5[[1]]
data_pca=data.frame(INDIV=pca$sample.id,
PC1=pca$eigenvect[,1],
PC2=pca$eigenvect[,2],
PC3=pca$eigenvect[,3],
PC4=pca$eigenvect[,4],
LOCA=c(rep("Algarve",5),
rep("Bay of Biscay",5),
rep("Gulf of Lion",5),
rep("Costa Calida",5)))
color_med_atl=rev(brewer.pal(n=4,name="RdBu"))
p<-ggplot(data=data_pca,aes(x=PC1,y=PC2,label=INDIV))+
theme_minimal()+
theme(panel.grid=element_blank(),
panel.border=element_rect(fill="transparent"),
plot.title=element_text(hjust=0.5))+
geom_hline(yintercept=0,lty=2)+
geom_vline(xintercept=0,lty=2)+
geom_point(size=3,aes(col=LOCA))+
xlab(paste("PCA 1 (",round(pca$varprop[1]*100,2),"% )",sep=""))+
ylab(paste("PCA 2 (",round(pca$varprop[2]*100,2),"% )",sep=""))+
scale_colour_manual(name="Location",
values=c(color_med_atl[2],
color_med_atl[1],
color_med_atl[3],
color_med_atl[4]))
p1<-p
p<-ggplot(data=data_pca,aes(x=PC3,y=PC4,label=INDIV))+
theme_minimal()+
theme(panel.grid=element_blank(),
panel.border=element_rect(fill="transparent"),
plot.title=element_text(hjust=0.5))+
geom_hline(yintercept=0,lty=2)+
geom_vline(xintercept=0,lty=2)+
geom_point(size=3,aes(col=LOCA))+
xlab(paste("PCA 3 (",round(pca$varprop[3]*100,2),"% )",sep=""))+
ylab(paste("PCA 4 (",round(pca$varprop[4]*100,2),"% )",sep=""))+
scale_colour_manual(name="Location",
values=c(color_med_atl[2],
color_med_atl[1],
color_med_atl[3],
color_med_atl[4]))
p2<-p
data_varpop=data.frame(PC=factor(paste("P",seq(1,10),sep=""),levels=paste("P",seq(1,10),sep="")),VAR=pca$varprop[1:10])
pp<-ggplot(data_varpop,aes(x=PC,y=VAR))+
geom_bar(stat='identity',fill="dodgerblue2",alpha=0.25)+
theme_classic()+
xlab("Principal Component")+
ylab("Variation explained (%)")
```
```{r}
subplot(ggplotly(p1)%>% layout(legend = list(orientation = "h", x = 0.2, y =-0.15)), ggplotly(p2)%>%hide_legend(), ggplotly(pp)%>%hide_legend(), titleX=T,titleY=T,margin=0.035,widths=c(0.375,0.425,0.2),which_layout=1) %>% partial_bundle()
```
Sarda sarda {data-navmenu="Species"}
=======================================================================
```{r, include = FALSE}
load(file = paste(path,"/output/pca/Ssard_PCA_list.Rdata",sep=""))
```
Row {.tabset data-height=100}
-----------------------
<center>
<font size="6">**Sarda sarda**</font>
</center>
Row {.tabset data-height=50}
-----------------------
<center>
<font size="6">**All filtered SNPS**</font>
</center>
Row {.tabset data-height=600}
-----------------------
### maf = 0
```{r}
pca=PCA_list$All_filtered$maf0[[1]]
data_pca=data.frame(INDIV=pca$sample.id,
PC1=pca$eigenvect[,1],
PC2=pca$eigenvect[,2],
PC3=pca$eigenvect[,3],
PC4=pca$eigenvect[,4],
LOCA=c(rep("Algarve",5),
rep("Bay of Biscay",5),
rep("Gulf of Lion",5),
rep("Costa Calida",5)))
color_med_atl=rev(brewer.pal(n=4,name="RdBu"))
p<-ggplot(data=data_pca,aes(x=PC1,y=PC2,label=INDIV))+
theme_minimal()+
theme(panel.grid=element_blank(),
panel.border=element_rect(fill="transparent"),
plot.title=element_text(hjust=0.5))+
geom_hline(yintercept=0,lty=2)+
geom_vline(xintercept=0,lty=2)+
geom_point(size=3,aes(col=LOCA))+
xlab(paste("PCA 1 (",round(pca$varprop[1]*100,2),"% )",sep=""))+
ylab(paste("PCA 2 (",round(pca$varprop[2]*100,2),"% )",sep=""))+
scale_colour_manual(name="Location",
values=c(color_med_atl[2],
color_med_atl[1],
color_med_atl[3],
color_med_atl[4]))
p1<-p
p<-ggplot(data=data_pca,aes(x=PC3,y=PC4,label=INDIV))+
theme_minimal()+
theme(panel.grid=element_blank(),
panel.border=element_rect(fill="transparent"),
plot.title=element_text(hjust=0.5))+
geom_hline(yintercept=0,lty=2)+
geom_vline(xintercept=0,lty=2)+
geom_point(size=3,aes(col=LOCA))+
xlab(paste("PCA 3 (",round(pca$varprop[3]*100,2),"% )",sep=""))+
ylab(paste("PCA 4 (",round(pca$varprop[4]*100,2),"% )",sep=""))+
scale_colour_manual(name="Location",
values=c(color_med_atl[2],
color_med_atl[1],
color_med_atl[3],
color_med_atl[4]))
p2<-p
data_varpop=data.frame(PC=factor(paste("P",seq(1,10),sep=""),levels=paste("P",seq(1,10),sep="")),VAR=pca$varprop[1:10])
pp<-ggplot(data_varpop,aes(x=PC,y=VAR))+
geom_bar(stat='identity',fill="dodgerblue2",alpha=0.25)+
theme_classic()+
xlab("Principal Component")+
ylab("Variation explained (%)")
```
```{r}
subplot(ggplotly(p1)%>% layout(legend = list(orientation = "h", x = 0.2, y =-0.15)), ggplotly(p2)%>%hide_legend(), ggplotly(pp)%>%hide_legend(), titleX=T,titleY=T,margin=0.035,widths=c(0.375,0.425,0.2),which_layout=1) %>% partial_bundle()
```
### maf = 0.05
```{r}
pca=PCA_list$All_filtered$maf0.05[[1]]
data_pca=data.frame(INDIV=pca$sample.id,
PC1=pca$eigenvect[,1],
PC2=pca$eigenvect[,2],
PC3=pca$eigenvect[,3],
PC4=pca$eigenvect[,4],
LOCA=c(rep("Algarve",5),
rep("Bay of Biscay",5),
rep("Gulf of Lion",5),
rep("Costa Calida",5)))
color_med_atl=rev(brewer.pal(n=4,name="RdBu"))
p<-ggplot(data=data_pca,aes(x=PC1,y=PC2,label=INDIV))+
theme_minimal()+
theme(panel.grid=element_blank(),
panel.border=element_rect(fill="transparent"),
plot.title=element_text(hjust=0.5))+
geom_hline(yintercept=0,lty=2)+
geom_vline(xintercept=0,lty=2)+
geom_point(size=3,aes(col=LOCA))+
xlab(paste("PCA 1 (",round(pca$varprop[1]*100,2),"% )",sep=""))+
ylab(paste("PCA 2 (",round(pca$varprop[2]*100,2),"% )",sep=""))+
scale_colour_manual(name="Location",
values=c(color_med_atl[2],
color_med_atl[1],
color_med_atl[3],
color_med_atl[4]))
p1<-p
p<-ggplot(data=data_pca,aes(x=PC3,y=PC4,label=INDIV))+
theme_minimal()+
theme(panel.grid=element_blank(),
panel.border=element_rect(fill="transparent"),
plot.title=element_text(hjust=0.5))+
geom_hline(yintercept=0,lty=2)+
geom_vline(xintercept=0,lty=2)+
geom_point(size=3,aes(col=LOCA))+
xlab(paste("PCA 3 (",round(pca$varprop[3]*100,2),"% )",sep=""))+
ylab(paste("PCA 4 (",round(pca$varprop[4]*100,2),"% )",sep=""))+
scale_colour_manual(name="Location",
values=c(color_med_atl[2],
color_med_atl[1],
color_med_atl[3],
color_med_atl[4]))
p2<-p
data_varpop=data.frame(PC=factor(paste("P",seq(1,10),sep=""),levels=paste("P",seq(1,10),sep="")),VAR=pca$varprop[1:10])
pp<-ggplot(data_varpop,aes(x=PC,y=VAR))+
geom_bar(stat='identity',fill="dodgerblue2",alpha=0.25)+
theme_classic()+
xlab("Principal Component")+
ylab("Variation explained (%)")
```
```{r}
subplot(ggplotly(p1)%>% layout(legend = list(orientation = "h", x = 0.2, y =-0.15)), ggplotly(p2)%>%hide_legend(), ggplotly(pp)%>%hide_legend(), titleX=T,titleY=T,margin=0.035,widths=c(0.375,0.425,0.2),which_layout=1) %>% partial_bundle()
```
### maf = 0.1
```{r}
pca=PCA_list$All_filtered$maf0.1[[1]]
data_pca=data.frame(INDIV=pca$sample.id,
PC1=pca$eigenvect[,1],
PC2=pca$eigenvect[,2],
PC3=pca$eigenvect[,3],
PC4=pca$eigenvect[,4],
LOCA=c(rep("Algarve",5),
rep("Bay of Biscay",5),
rep("Gulf of Lion",5),
rep("Costa Calida",5)))
color_med_atl=rev(brewer.pal(n=4,name="RdBu"))
p<-ggplot(data=data_pca,aes(x=PC1,y=PC2,label=INDIV))+
theme_minimal()+
theme(panel.grid=element_blank(),
panel.border=element_rect(fill="transparent"),
plot.title=element_text(hjust=0.5))+
geom_hline(yintercept=0,lty=2)+
geom_vline(xintercept=0,lty=2)+
geom_point(size=3,aes(col=LOCA))+
xlab(paste("PCA 1 (",round(pca$varprop[1]*100,2),"% )",sep=""))+
ylab(paste("PCA 2 (",round(pca$varprop[2]*100,2),"% )",sep=""))+
scale_colour_manual(name="Location",
values=c(color_med_atl[2],
color_med_atl[1],
color_med_atl[3],
color_med_atl[4]))
p1<-p
p<-ggplot(data=data_pca,aes(x=PC3,y=PC4,label=INDIV))+
theme_minimal()+
theme(panel.grid=element_blank(),
panel.border=element_rect(fill="transparent"),
plot.title=element_text(hjust=0.5))+
geom_hline(yintercept=0,lty=2)+
geom_vline(xintercept=0,lty=2)+
geom_point(size=3,aes(col=LOCA))+
xlab(paste("PCA 3 (",round(pca$varprop[3]*100,2),"% )",sep=""))+
ylab(paste("PCA 4 (",round(pca$varprop[4]*100,2),"% )",sep=""))+
scale_colour_manual(name="Location",
values=c(color_med_atl[2],
color_med_atl[1],
color_med_atl[3],
color_med_atl[4]))
p2<-p
data_varpop=data.frame(PC=factor(paste("P",seq(1,10),sep=""),levels=paste("P",seq(1,10),sep="")),VAR=pca$varprop[1:10])
pp<-ggplot(data_varpop,aes(x=PC,y=VAR))+
geom_bar(stat='identity',fill="dodgerblue2",alpha=0.25)+
theme_classic()+
xlab("Principal Component")+
ylab("Variation explained (%)")
```
```{r}
subplot(ggplotly(p1)%>% layout(legend = list(orientation = "h", x = 0.2, y =-0.15)), ggplotly(p2)%>%hide_legend(), ggplotly(pp)%>%hide_legend(), titleX=T,titleY=T,margin=0.035,widths=c(0.375,0.425,0.2),which_layout=1) %>% partial_bundle()
```
### maf = 0.15
```{r}
pca=PCA_list$All_filtered$maf0.15[[1]]
data_pca=data.frame(INDIV=pca$sample.id,
PC1=pca$eigenvect[,1],
PC2=pca$eigenvect[,2],
PC3=pca$eigenvect[,3],
PC4=pca$eigenvect[,4],
LOCA=c(rep("Algarve",5),
rep("Bay of Biscay",5),
rep("Gulf of Lion",5),
rep("Costa Calida",5)))
color_med_atl=rev(brewer.pal(n=4,name="RdBu"))
p<-ggplot(data=data_pca,aes(x=PC1,y=PC2,label=INDIV))+
theme_minimal()+
theme(panel.grid=element_blank(),
panel.border=element_rect(fill="transparent"),
plot.title=element_text(hjust=0.5))+
geom_hline(yintercept=0,lty=2)+
geom_vline(xintercept=0,lty=2)+
geom_point(size=3,aes(col=LOCA))+
xlab(paste("PCA 1 (",round(pca$varprop[1]*100,2),"% )",sep=""))+
ylab(paste("PCA 2 (",round(pca$varprop[2]*100,2),"% )",sep=""))+
scale_colour_manual(name="Location",
values=c(color_med_atl[2],
color_med_atl[1],
color_med_atl[3],
color_med_atl[4]))
p1<-p
p<-ggplot(data=data_pca,aes(x=PC3,y=PC4,label=INDIV))+
theme_minimal()+
theme(panel.grid=element_blank(),
panel.border=element_rect(fill="transparent"),
plot.title=element_text(hjust=0.5))+
geom_hline(yintercept=0,lty=2)+
geom_vline(xintercept=0,lty=2)+
geom_point(size=3,aes(col=LOCA))+
xlab(paste("PCA 3 (",round(pca$varprop[3]*100,2),"% )",sep=""))+
ylab(paste("PCA 4 (",round(pca$varprop[4]*100,2),"% )",sep=""))+
scale_colour_manual(name="Location",
values=c(color_med_atl[2],
color_med_atl[1],
color_med_atl[3],
color_med_atl[4]))
p2<-p
data_varpop=data.frame(PC=factor(paste("P",seq(1,10),sep=""),levels=paste("P",seq(1,10),sep="")),VAR=pca$varprop[1:10])
pp<-ggplot(data_varpop,aes(x=PC,y=VAR))+
geom_bar(stat='identity',fill="dodgerblue2",alpha=0.25)+
theme_classic()+
xlab("Principal Component")+
ylab("Variation explained (%)")
```
```{r}
subplot(ggplotly(p1)%>% layout(legend = list(orientation = "h", x = 0.2, y =-0.15)), ggplotly(p2)%>%hide_legend(), ggplotly(pp)%>%hide_legend(), titleX=T,titleY=T,margin=0.035,widths=c(0.375,0.425,0.2),which_layout=1) %>% partial_bundle()
```
### maf = 0.20
```{r}
pca=PCA_list$All_filtered$maf0.2[[1]]
data_pca=data.frame(INDIV=pca$sample.id,
PC1=pca$eigenvect[,1],
PC2=pca$eigenvect[,2],
PC3=pca$eigenvect[,3],
PC4=pca$eigenvect[,4],
LOCA=c(rep("Algarve",5),
rep("Bay of Biscay",5),
rep("Gulf of Lion",5),
rep("Costa Calida",5)))
color_med_atl=rev(brewer.pal(n=4,name="RdBu"))
p<-ggplot(data=data_pca,aes(x=PC1,y=PC2,label=INDIV))+
theme_minimal()+
theme(panel.grid=element_blank(),
panel.border=element_rect(fill="transparent"),
plot.title=element_text(hjust=0.5))+
geom_hline(yintercept=0,lty=2)+
geom_vline(xintercept=0,lty=2)+
geom_point(size=3,aes(col=LOCA))+
xlab(paste("PCA 1 (",round(pca$varprop[1]*100,2),"% )",sep=""))+
ylab(paste("PCA 2 (",round(pca$varprop[2]*100,2),"% )",sep=""))+
scale_colour_manual(name="Location",
values=c(color_med_atl[2],
color_med_atl[1],
color_med_atl[3],
color_med_atl[4]))
p1<-p
p<-ggplot(data=data_pca,aes(x=PC3,y=PC4,label=INDIV))+
theme_minimal()+
theme(panel.grid=element_blank(),
panel.border=element_rect(fill="transparent"),
plot.title=element_text(hjust=0.5))+
geom_hline(yintercept=0,lty=2)+
geom_vline(xintercept=0,lty=2)+
geom_point(size=3,aes(col=LOCA))+
xlab(paste("PCA 3 (",round(pca$varprop[3]*100,2),"% )",sep=""))+
ylab(paste("PCA 4 (",round(pca$varprop[4]*100,2),"% )",sep=""))+
scale_colour_manual(name="Location",
values=c(color_med_atl[2],
color_med_atl[1],
color_med_atl[3],
color_med_atl[4]))
p2<-p
data_varpop=data.frame(PC=factor(paste("P",seq(1,10),sep=""),levels=paste("P",seq(1,10),sep="")),VAR=pca$varprop[1:10])
pp<-ggplot(data_varpop,aes(x=PC,y=VAR))+
geom_bar(stat='identity',fill="dodgerblue2",alpha=0.25)+
theme_classic()+
xlab("Principal Component")+
ylab("Variation explained (%)")
```
```{r}
subplot(ggplotly(p1)%>% layout(legend = list(orientation = "h", x = 0.2, y =-0.15)), ggplotly(p2)%>%hide_legend(), ggplotly(pp)%>%hide_legend(), titleX=T,titleY=T,margin=0.035,widths=c(0.375,0.425,0.2),which_layout=1) %>% partial_bundle()
```
### maf = 0.25
```{r}
pca=PCA_list$All_filtered$maf0.25[[1]]
data_pca=data.frame(INDIV=pca$sample.id,
PC1=pca$eigenvect[,1],
PC2=pca$eigenvect[,2],
PC3=pca$eigenvect[,3],
PC4=pca$eigenvect[,4],
LOCA=c(rep("Algarve",5),
rep("Bay of Biscay",5),
rep("Gulf of Lion",5),
rep("Costa Calida",5)))
color_med_atl=rev(brewer.pal(n=4,name="RdBu"))
p<-ggplot(data=data_pca,aes(x=PC1,y=PC2,label=INDIV))+
theme_minimal()+
theme(panel.grid=element_blank(),
panel.border=element_rect(fill="transparent"),
plot.title=element_text(hjust=0.5))+
geom_hline(yintercept=0,lty=2)+
geom_vline(xintercept=0,lty=2)+
geom_point(size=3,aes(col=LOCA))+
xlab(paste("PCA 1 (",round(pca$varprop[1]*100,2),"% )",sep=""))+
ylab(paste("PCA 2 (",round(pca$varprop[2]*100,2),"% )",sep=""))+
scale_colour_manual(name="Location",
values=c(color_med_atl[2],
color_med_atl[1],
color_med_atl[3],
color_med_atl[4]))
p1<-p
p<-ggplot(data=data_pca,aes(x=PC3,y=PC4,label=INDIV))+
theme_minimal()+
theme(panel.grid=element_blank(),
panel.border=element_rect(fill="transparent"),
plot.title=element_text(hjust=0.5))+
geom_hline(yintercept=0,lty=2)+
geom_vline(xintercept=0,lty=2)+
geom_point(size=3,aes(col=LOCA))+
xlab(paste("PCA 3 (",round(pca$varprop[3]*100,2),"% )",sep=""))+
ylab(paste("PCA 4 (",round(pca$varprop[4]*100,2),"% )",sep=""))+
scale_colour_manual(name="Location",
values=c(color_med_atl[2],
color_med_atl[1],
color_med_atl[3],
color_med_atl[4]))
p2<-p
data_varpop=data.frame(PC=factor(paste("P",seq(1,10),sep=""),levels=paste("P",seq(1,10),sep="")),VAR=pca$varprop[1:10])
pp<-ggplot(data_varpop,aes(x=PC,y=VAR))+
geom_bar(stat='identity',fill="dodgerblue2",alpha=0.25)+
theme_classic()+
xlab("Principal Component")+
ylab("Variation explained (%)")
```
```{r}
subplot(ggplotly(p1)%>% layout(legend = list(orientation = "h", x = 0.2, y =-0.15)), ggplotly(p2)%>%hide_legend(), ggplotly(pp)%>%hide_legend(), titleX=T,titleY=T,margin=0.035,widths=c(0.375,0.425,0.2),which_layout=1) %>% partial_bundle()
```
### maf = 0.30
```{r}
pca=PCA_list$All_filtered$maf0.3[[1]]
data_pca=data.frame(INDIV=pca$sample.id,
PC1=pca$eigenvect[,1],
PC2=pca$eigenvect[,2],
PC3=pca$eigenvect[,3],
PC4=pca$eigenvect[,4],
LOCA=c(rep("Algarve",5),
rep("Bay of Biscay",5),
rep("Gulf of Lion",5),
rep("Costa Calida",5)))
color_med_atl=rev(brewer.pal(n=4,name="RdBu"))
p<-ggplot(data=data_pca,aes(x=PC1,y=PC2,label=INDIV))+
theme_minimal()+
theme(panel.grid=element_blank(),
panel.border=element_rect(fill="transparent"),
plot.title=element_text(hjust=0.5))+
geom_hline(yintercept=0,lty=2)+
geom_vline(xintercept=0,lty=2)+
geom_point(size=3,aes(col=LOCA))+
xlab(paste("PCA 1 (",round(pca$varprop[1]*100,2),"% )",sep=""))+
ylab(paste("PCA 2 (",round(pca$varprop[2]*100,2),"% )",sep=""))+
scale_colour_manual(name="Location",
values=c(color_med_atl[2],
color_med_atl[1],
color_med_atl[3],
color_med_atl[4]))
p1<-p
p<-ggplot(data=data_pca,aes(x=PC3,y=PC4,label=INDIV))+
theme_minimal()+
theme(panel.grid=element_blank(),
panel.border=element_rect(fill="transparent"),
plot.title=element_text(hjust=0.5))+
geom_hline(yintercept=0,lty=2)+
geom_vline(xintercept=0,lty=2)+
geom_point(size=3,aes(col=LOCA))+
xlab(paste("PCA 3 (",round(pca$varprop[3]*100,2),"% )",sep=""))+
ylab(paste("PCA 4 (",round(pca$varprop[4]*100,2),"% )",sep=""))+
scale_colour_manual(name="Location",
values=c(color_med_atl[2],
color_med_atl[1],
color_med_atl[3],
color_med_atl[4]))
p2<-p
data_varpop=data.frame(PC=factor(paste("P",seq(1,10),sep=""),levels=paste("P",seq(1,10),sep="")),VAR=pca$varprop[1:10])
pp<-ggplot(data_varpop,aes(x=PC,y=VAR))+
geom_bar(stat='identity',fill="dodgerblue2",alpha=0.25)+
theme_classic()+
xlab("Principal Component")+
ylab("Variation explained (%)")
```
```{r}
subplot(ggplotly(p1)%>% layout(legend = list(orientation = "h", x = 0.2, y =-0.15)), ggplotly(p2)%>%hide_legend(), ggplotly(pp)%>%hide_legend(), titleX=T,titleY=T,margin=0.035,widths=c(0.375,0.425,0.2),which_layout=1) %>% partial_bundle()
```
### maf = 0.35
```{r}
pca=PCA_list$All_filtered$maf0.35[[1]]
data_pca=data.frame(INDIV=pca$sample.id,
PC1=pca$eigenvect[,1],
PC2=pca$eigenvect[,2],
PC3=pca$eigenvect[,3],
PC4=pca$eigenvect[,4],
LOCA=c(rep("Algarve",5),
rep("Bay of Biscay",5),
rep("Gulf of Lion",5),
rep("Costa Calida",5)))
color_med_atl=rev(brewer.pal(n=4,name="RdBu"))
p<-ggplot(data=data_pca,aes(x=PC1,y=PC2,label=INDIV))+
theme_minimal()+
theme(panel.grid=element_blank(),
panel.border=element_rect(fill="transparent"),
plot.title=element_text(hjust=0.5))+
geom_hline(yintercept=0,lty=2)+
geom_vline(xintercept=0,lty=2)+
geom_point(size=3,aes(col=LOCA))+
xlab(paste("PCA 1 (",round(pca$varprop[1]*100,2),"% )",sep=""))+
ylab(paste("PCA 2 (",round(pca$varprop[2]*100,2),"% )",sep=""))+
scale_colour_manual(name="Location",
values=c(color_med_atl[2],
color_med_atl[1],
color_med_atl[3],
color_med_atl[4]))
p1<-p
p<-ggplot(data=data_pca,aes(x=PC3,y=PC4,label=INDIV))+
theme_minimal()+
theme(panel.grid=element_blank(),
panel.border=element_rect(fill="transparent"),
plot.title=element_text(hjust=0.5))+
geom_hline(yintercept=0,lty=2)+
geom_vline(xintercept=0,lty=2)+
geom_point(size=3,aes(col=LOCA))+
xlab(paste("PCA 3 (",round(pca$varprop[3]*100,2),"% )",sep=""))+
ylab(paste("PCA 4 (",round(pca$varprop[4]*100,2),"% )",sep=""))+
scale_colour_manual(name="Location",
values=c(color_med_atl[2],
color_med_atl[1],
color_med_atl[3],
color_med_atl[4]))
p2<-p
data_varpop=data.frame(PC=factor(paste("P",seq(1,10),sep=""),levels=paste("P",seq(1,10),sep="")),VAR=pca$varprop[1:10])
pp<-ggplot(data_varpop,aes(x=PC,y=VAR))+
geom_bar(stat='identity',fill="dodgerblue2",alpha=0.25)+
theme_classic()+
xlab("Principal Component")+
ylab("Variation explained (%)")
```
```{r}
subplot(ggplotly(p1)%>% layout(legend = list(orientation = "h", x = 0.2, y =-0.15)), ggplotly(p2)%>%hide_legend(), ggplotly(pp)%>%hide_legend(), titleX=T,titleY=T,margin=0.035,widths=c(0.375,0.425,0.2),which_layout=1) %>% partial_bundle()
```
### maf = 0.40
```{r}
pca=PCA_list$All_filtered$maf0.4[[1]]
data_pca=data.frame(INDIV=pca$sample.id,
PC1=pca$eigenvect[,1],
PC2=pca$eigenvect[,2],
PC3=pca$eigenvect[,3],
PC4=pca$eigenvect[,4],
LOCA=c(rep("Algarve",5),
rep("Bay of Biscay",5),
rep("Gulf of Lion",5),
rep("Costa Calida",5)))
color_med_atl=rev(brewer.pal(n=4,name="RdBu"))
p<-ggplot(data=data_pca,aes(x=PC1,y=PC2,label=INDIV))+
theme_minimal()+
theme(panel.grid=element_blank(),
panel.border=element_rect(fill="transparent"),
plot.title=element_text(hjust=0.5))+
geom_hline(yintercept=0,lty=2)+
geom_vline(xintercept=0,lty=2)+
geom_point(size=3,aes(col=LOCA))+
xlab(paste("PCA 1 (",round(pca$varprop[1]*100,2),"% )",sep=""))+
ylab(paste("PCA 2 (",round(pca$varprop[2]*100,2),"% )",sep=""))+
scale_colour_manual(name="Location",
values=c(color_med_atl[2],
color_med_atl[1],
color_med_atl[3],
color_med_atl[4]))
p1<-p
p<-ggplot(data=data_pca,aes(x=PC3,y=PC4,label=INDIV))+
theme_minimal()+
theme(panel.grid=element_blank(),
panel.border=element_rect(fill="transparent"),
plot.title=element_text(hjust=0.5))+
geom_hline(yintercept=0,lty=2)+
geom_vline(xintercept=0,lty=2)+
geom_point(size=3,aes(col=LOCA))+
xlab(paste("PCA 3 (",round(pca$varprop[3]*100,2),"% )",sep=""))+
ylab(paste("PCA 4 (",round(pca$varprop[4]*100,2),"% )",sep=""))+
scale_colour_manual(name="Location",
values=c(color_med_atl[2],
color_med_atl[1],
color_med_atl[3],
color_med_atl[4]))
p2<-p
data_varpop=data.frame(PC=factor(paste("P",seq(1,10),sep=""),levels=paste("P",seq(1,10),sep="")),VAR=pca$varprop[1:10])
pp<-ggplot(data_varpop,aes(x=PC,y=VAR))+
geom_bar(stat='identity',fill="dodgerblue2",alpha=0.25)+
theme_classic()+
xlab("Principal Component")+
ylab("Variation explained (%)")
```
```{r}
subplot(ggplotly(p1)%>% layout(legend = list(orientation = "h", x = 0.2, y =-0.15)), ggplotly(p2)%>%hide_legend(), ggplotly(pp)%>%hide_legend(), titleX=T,titleY=T,margin=0.035,widths=c(0.375,0.425,0.2),which_layout=1) %>% partial_bundle()
```
### maf = 0.45
```{r}
pca=PCA_list$All_filtered$maf0.45[[1]]
data_pca=data.frame(INDIV=pca$sample.id,
PC1=pca$eigenvect[,1],
PC2=pca$eigenvect[,2],
PC3=pca$eigenvect[,3],
PC4=pca$eigenvect[,4],
LOCA=c(rep("Algarve",5),
rep("Bay of Biscay",5),
rep("Gulf of Lion",5),
rep("Costa Calida",5)))
color_med_atl=rev(brewer.pal(n=4,name="RdBu"))
p<-ggplot(data=data_pca,aes(x=PC1,y=PC2,label=INDIV))+
theme_minimal()+
theme(panel.grid=element_blank(),
panel.border=element_rect(fill="transparent"),
plot.title=element_text(hjust=0.5))+
geom_hline(yintercept=0,lty=2)+
geom_vline(xintercept=0,lty=2)+
geom_point(size=3,aes(col=LOCA))+
xlab(paste("PCA 1 (",round(pca$varprop[1]*100,2),"% )",sep=""))+
ylab(paste("PCA 2 (",round(pca$varprop[2]*100,2),"% )",sep=""))+
scale_colour_manual(name="Location",
values=c(color_med_atl[2],
color_med_atl[1],
color_med_atl[3],
color_med_atl[4]))
p1<-p
p<-ggplot(data=data_pca,aes(x=PC3,y=PC4,label=INDIV))+
theme_minimal()+
theme(panel.grid=element_blank(),
panel.border=element_rect(fill="transparent"),
plot.title=element_text(hjust=0.5))+
geom_hline(yintercept=0,lty=2)+
geom_vline(xintercept=0,lty=2)+
geom_point(size=3,aes(col=LOCA))+
xlab(paste("PCA 3 (",round(pca$varprop[3]*100,2),"% )",sep=""))+
ylab(paste("PCA 4 (",round(pca$varprop[4]*100,2),"% )",sep=""))+
scale_colour_manual(name="Location",
values=c(color_med_atl[2],
color_med_atl[1],
color_med_atl[3],
color_med_atl[4]))
p2<-p
data_varpop=data.frame(PC=factor(paste("P",seq(1,10),sep=""),levels=paste("P",seq(1,10),sep="")),VAR=pca$varprop[1:10])
pp<-ggplot(data_varpop,aes(x=PC,y=VAR))+
geom_bar(stat='identity',fill="dodgerblue2",alpha=0.25)+
theme_classic()+
xlab("Principal Component")+
ylab("Variation explained (%)")
```
```{r}
subplot(ggplotly(p1)%>% layout(legend = list(orientation = "h", x = 0.2, y =-0.15)), ggplotly(p2)%>%hide_legend(), ggplotly(pp)%>%hide_legend(), titleX=T,titleY=T,margin=0.035,widths=c(0.375,0.425,0.2),which_layout=1) %>% partial_bundle()
```
### maf = 0.50
```{r}
pca=PCA_list$All_filtered$maf0.5[[1]]
data_pca=data.frame(INDIV=pca$sample.id,
PC1=pca$eigenvect[,1],
PC2=pca$eigenvect[,2],
PC3=pca$eigenvect[,3],
PC4=pca$eigenvect[,4],
LOCA=c(rep("Algarve",5),
rep("Bay of Biscay",5),
rep("Gulf of Lion",5),
rep("Costa Calida",5)))
color_med_atl=rev(brewer.pal(n=4,name="RdBu"))
p<-ggplot(data=data_pca,aes(x=PC1,y=PC2,label=INDIV))+
theme_minimal()+
theme(panel.grid=element_blank(),
panel.border=element_rect(fill="transparent"),
plot.title=element_text(hjust=0.5))+
geom_hline(yintercept=0,lty=2)+
geom_vline(xintercept=0,lty=2)+
geom_point(size=3,aes(col=LOCA))+
xlab(paste("PCA 1 (",round(pca$varprop[1]*100,2),"% )",sep=""))+
ylab(paste("PCA 2 (",round(pca$varprop[2]*100,2),"% )",sep=""))+
scale_colour_manual(name="Location",
values=c(color_med_atl[2],
color_med_atl[1],
color_med_atl[3],
color_med_atl[4]))
p1<-p
p<-ggplot(data=data_pca,aes(x=PC3,y=PC4,label=INDIV))+
theme_minimal()+
theme(panel.grid=element_blank(),
panel.border=element_rect(fill="transparent"),
plot.title=element_text(hjust=0.5))+
geom_hline(yintercept=0,lty=2)+
geom_vline(xintercept=0,lty=2)+
geom_point(size=3,aes(col=LOCA))+
xlab(paste("PCA 3 (",round(pca$varprop[3]*100,2),"% )",sep=""))+
ylab(paste("PCA 4 (",round(pca$varprop[4]*100,2),"% )",sep=""))+
scale_colour_manual(name="Location",
values=c(color_med_atl[2],
color_med_atl[1],
color_med_atl[3],
color_med_atl[4]))
p2<-p
data_varpop=data.frame(PC=factor(paste("P",seq(1,10),sep=""),levels=paste("P",seq(1,10),sep="")),VAR=pca$varprop[1:10])
pp<-ggplot(data_varpop,aes(x=PC,y=VAR))+
geom_bar(stat='identity',fill="dodgerblue2",alpha=0.25)+
theme_classic()+
xlab("Principal Component")+
ylab("Variation explained (%)")
```
```{r}
subplot(ggplotly(p1)%>% layout(legend = list(orientation = "h", x = 0.2, y =-0.15)), ggplotly(p2)%>%hide_legend(), ggplotly(pp)%>%hide_legend(), titleX=T,titleY=T,margin=0.035,widths=c(0.375,0.425,0.2),which_layout=1) %>% partial_bundle()
```
Row {.tabset data-height=50}
-----------------------
<center>
<font size="6">**Pruned filtered SNPS**</font>
</center>
Row {.tabset data-height=600}
-----------------------
### maf = 0
```{r}
pca=PCA_list$Prune_filtered$maf0[[1]]
data_pca=data.frame(INDIV=pca$sample.id,
PC1=pca$eigenvect[,1],
PC2=pca$eigenvect[,2],
PC3=pca$eigenvect[,3],
PC4=pca$eigenvect[,4],
LOCA=c(rep("Algarve",5),
rep("Bay of Biscay",5),
rep("Gulf of Lion",5),
rep("Costa Calida",5)))
color_med_atl=rev(brewer.pal(n=4,name="RdBu"))
p<-ggplot(data=data_pca,aes(x=PC1,y=PC2,label=INDIV))+
theme_minimal()+
theme(panel.grid=element_blank(),
panel.border=element_rect(fill="transparent"),
plot.title=element_text(hjust=0.5))+
geom_hline(yintercept=0,lty=2)+
geom_vline(xintercept=0,lty=2)+
geom_point(size=3,aes(col=LOCA))+
xlab(paste("PCA 1 (",round(pca$varprop[1]*100,2),"% )",sep=""))+
ylab(paste("PCA 2 (",round(pca$varprop[2]*100,2),"% )",sep=""))+
scale_colour_manual(name="Location",
values=c(color_med_atl[2],
color_med_atl[1],
color_med_atl[3],
color_med_atl[4]))
p1<-p
p<-ggplot(data=data_pca,aes(x=PC3,y=PC4,label=INDIV))+
theme_minimal()+
theme(panel.grid=element_blank(),
panel.border=element_rect(fill="transparent"),
plot.title=element_text(hjust=0.5))+
geom_hline(yintercept=0,lty=2)+
geom_vline(xintercept=0,lty=2)+
geom_point(size=3,aes(col=LOCA))+
xlab(paste("PCA 3 (",round(pca$varprop[3]*100,2),"% )",sep=""))+
ylab(paste("PCA 4 (",round(pca$varprop[4]*100,2),"% )",sep=""))+
scale_colour_manual(name="Location",
values=c(color_med_atl[2],
color_med_atl[1],
color_med_atl[3],
color_med_atl[4]))
p2<-p
data_varpop=data.frame(PC=factor(paste("P",seq(1,10),sep=""),levels=paste("P",seq(1,10),sep="")),VAR=pca$varprop[1:10])
pp<-ggplot(data_varpop,aes(x=PC,y=VAR))+
geom_bar(stat='identity',fill="dodgerblue2",alpha=0.25)+
theme_classic()+
xlab("Principal Component")+
ylab("Variation explained (%)")
```
```{r}
subplot(ggplotly(p1)%>% layout(legend = list(orientation = "h", x = 0.2, y =-0.15)), ggplotly(p2)%>%hide_legend(), ggplotly(pp)%>%hide_legend(), titleX=T,titleY=T,margin=0.035,widths=c(0.375,0.425,0.2),which_layout=1) %>% partial_bundle()
```
### maf = 0.05
```{r}
pca=PCA_list$Prune_filtered$maf0.05[[1]]
data_pca=data.frame(INDIV=pca$sample.id,
PC1=pca$eigenvect[,1],
PC2=pca$eigenvect[,2],
PC3=pca$eigenvect[,3],
PC4=pca$eigenvect[,4],
LOCA=c(rep("Algarve",5),
rep("Bay of Biscay",5),
rep("Gulf of Lion",5),
rep("Costa Calida",5)))
color_med_atl=rev(brewer.pal(n=4,name="RdBu"))
p<-ggplot(data=data_pca,aes(x=PC1,y=PC2,label=INDIV))+
theme_minimal()+
theme(panel.grid=element_blank(),
panel.border=element_rect(fill="transparent"),
plot.title=element_text(hjust=0.5))+
geom_hline(yintercept=0,lty=2)+
geom_vline(xintercept=0,lty=2)+
geom_point(size=3,aes(col=LOCA))+
xlab(paste("PCA 1 (",round(pca$varprop[1]*100,2),"% )",sep=""))+
ylab(paste("PCA 2 (",round(pca$varprop[2]*100,2),"% )",sep=""))+
scale_colour_manual(name="Location",
values=c(color_med_atl[2],
color_med_atl[1],
color_med_atl[3],
color_med_atl[4]))
p1<-p
p<-ggplot(data=data_pca,aes(x=PC3,y=PC4,label=INDIV))+
theme_minimal()+
theme(panel.grid=element_blank(),
panel.border=element_rect(fill="transparent"),
plot.title=element_text(hjust=0.5))+
geom_hline(yintercept=0,lty=2)+
geom_vline(xintercept=0,lty=2)+
geom_point(size=3,aes(col=LOCA))+
xlab(paste("PCA 3 (",round(pca$varprop[3]*100,2),"% )",sep=""))+
ylab(paste("PCA 4 (",round(pca$varprop[4]*100,2),"% )",sep=""))+
scale_colour_manual(name="Location",
values=c(color_med_atl[2],
color_med_atl[1],
color_med_atl[3],
color_med_atl[4]))
p2<-p
data_varpop=data.frame(PC=factor(paste("P",seq(1,10),sep=""),levels=paste("P",seq(1,10),sep="")),VAR=pca$varprop[1:10])
pp<-ggplot(data_varpop,aes(x=PC,y=VAR))+
geom_bar(stat='identity',fill="dodgerblue2",alpha=0.25)+
theme_classic()+
xlab("Principal Component")+
ylab("Variation explained (%)")
```
```{r}
subplot(ggplotly(p1)%>% layout(legend = list(orientation = "h", x = 0.2, y =-0.15)), ggplotly(p2)%>%hide_legend(), ggplotly(pp)%>%hide_legend(), titleX=T,titleY=T,margin=0.035,widths=c(0.375,0.425,0.2),which_layout=1) %>% partial_bundle()
```
### maf = 0.1
```{r}
pca=PCA_list$Prune_filtered$maf0.1[[1]]
data_pca=data.frame(INDIV=pca$sample.id,
PC1=pca$eigenvect[,1],
PC2=pca$eigenvect[,2],
PC3=pca$eigenvect[,3],
PC4=pca$eigenvect[,4],
LOCA=c(rep("Algarve",5),
rep("Bay of Biscay",5),
rep("Gulf of Lion",5),
rep("Costa Calida",5)))
color_med_atl=rev(brewer.pal(n=4,name="RdBu"))
p<-ggplot(data=data_pca,aes(x=PC1,y=PC2,label=INDIV))+
theme_minimal()+
theme(panel.grid=element_blank(),
panel.border=element_rect(fill="transparent"),
plot.title=element_text(hjust=0.5))+
geom_hline(yintercept=0,lty=2)+
geom_vline(xintercept=0,lty=2)+
geom_point(size=3,aes(col=LOCA))+
xlab(paste("PCA 1 (",round(pca$varprop[1]*100,2),"% )",sep=""))+
ylab(paste("PCA 2 (",round(pca$varprop[2]*100,2),"% )",sep=""))+
scale_colour_manual(name="Location",
values=c(color_med_atl[2],
color_med_atl[1],
color_med_atl[3],
color_med_atl[4]))
p1<-p
p<-ggplot(data=data_pca,aes(x=PC3,y=PC4,label=INDIV))+
theme_minimal()+
theme(panel.grid=element_blank(),
panel.border=element_rect(fill="transparent"),
plot.title=element_text(hjust=0.5))+
geom_hline(yintercept=0,lty=2)+
geom_vline(xintercept=0,lty=2)+
geom_point(size=3,aes(col=LOCA))+
xlab(paste("PCA 3 (",round(pca$varprop[3]*100,2),"% )",sep=""))+
ylab(paste("PCA 4 (",round(pca$varprop[4]*100,2),"% )",sep=""))+
scale_colour_manual(name="Location",
values=c(color_med_atl[2],
color_med_atl[1],
color_med_atl[3],
color_med_atl[4]))
p2<-p
data_varpop=data.frame(PC=factor(paste("P",seq(1,10),sep=""),levels=paste("P",seq(1,10),sep="")),VAR=pca$varprop[1:10])
pp<-ggplot(data_varpop,aes(x=PC,y=VAR))+
geom_bar(stat='identity',fill="dodgerblue2",alpha=0.25)+
theme_classic()+
xlab("Principal Component")+
ylab("Variation explained (%)")
```
```{r}
subplot(ggplotly(p1)%>% layout(legend = list(orientation = "h", x = 0.2, y =-0.15)), ggplotly(p2)%>%hide_legend(), ggplotly(pp)%>%hide_legend(), titleX=T,titleY=T,margin=0.035,widths=c(0.375,0.425,0.2),which_layout=1) %>% partial_bundle()
```
### maf = 0.15
```{r}
pca=PCA_list$Prune_filtered$maf0.15[[1]]
data_pca=data.frame(INDIV=pca$sample.id,
PC1=pca$eigenvect[,1],
PC2=pca$eigenvect[,2],
PC3=pca$eigenvect[,3],
PC4=pca$eigenvect[,4],
LOCA=c(rep("Algarve",5),
rep("Bay of Biscay",5),
rep("Gulf of Lion",5),
rep("Costa Calida",5)))
color_med_atl=rev(brewer.pal(n=4,name="RdBu"))
p<-ggplot(data=data_pca,aes(x=PC1,y=PC2,label=INDIV))+
theme_minimal()+
theme(panel.grid=element_blank(),
panel.border=element_rect(fill="transparent"),
plot.title=element_text(hjust=0.5))+
geom_hline(yintercept=0,lty=2)+
geom_vline(xintercept=0,lty=2)+
geom_point(size=3,aes(col=LOCA))+
xlab(paste("PCA 1 (",round(pca$varprop[1]*100,2),"% )",sep=""))+
ylab(paste("PCA 2 (",round(pca$varprop[2]*100,2),"% )",sep=""))+
scale_colour_manual(name="Location",
values=c(color_med_atl[2],
color_med_atl[1],
color_med_atl[3],
color_med_atl[4]))
p1<-p
p<-ggplot(data=data_pca,aes(x=PC3,y=PC4,label=INDIV))+
theme_minimal()+
theme(panel.grid=element_blank(),
panel.border=element_rect(fill="transparent"),
plot.title=element_text(hjust=0.5))+
geom_hline(yintercept=0,lty=2)+
geom_vline(xintercept=0,lty=2)+
geom_point(size=3,aes(col=LOCA))+
xlab(paste("PCA 3 (",round(pca$varprop[3]*100,2),"% )",sep=""))+
ylab(paste("PCA 4 (",round(pca$varprop[4]*100,2),"% )",sep=""))+
scale_colour_manual(name="Location",
values=c(color_med_atl[2],
color_med_atl[1],
color_med_atl[3],
color_med_atl[4]))
p2<-p
data_varpop=data.frame(PC=factor(paste("P",seq(1,10),sep=""),levels=paste("P",seq(1,10),sep="")),VAR=pca$varprop[1:10])
pp<-ggplot(data_varpop,aes(x=PC,y=VAR))+
geom_bar(stat='identity',fill="dodgerblue2",alpha=0.25)+
theme_classic()+
xlab("Principal Component")+
ylab("Variation explained (%)")
```
```{r}
subplot(ggplotly(p1)%>% layout(legend = list(orientation = "h", x = 0.2, y =-0.15)), ggplotly(p2)%>%hide_legend(), ggplotly(pp)%>%hide_legend(), titleX=T,titleY=T,margin=0.035,widths=c(0.375,0.425,0.2),which_layout=1) %>% partial_bundle()
```
### maf = 0.20
```{r}
pca=PCA_list$Prune_filtered$maf0.2[[1]]
data_pca=data.frame(INDIV=pca$sample.id,
PC1=pca$eigenvect[,1],
PC2=pca$eigenvect[,2],
PC3=pca$eigenvect[,3],
PC4=pca$eigenvect[,4],
LOCA=c(rep("Algarve",5),
rep("Bay of Biscay",5),
rep("Gulf of Lion",5),
rep("Costa Calida",5)))
color_med_atl=rev(brewer.pal(n=4,name="RdBu"))
p<-ggplot(data=data_pca,aes(x=PC1,y=PC2,label=INDIV))+
theme_minimal()+
theme(panel.grid=element_blank(),
panel.border=element_rect(fill="transparent"),
plot.title=element_text(hjust=0.5))+
geom_hline(yintercept=0,lty=2)+
geom_vline(xintercept=0,lty=2)+
geom_point(size=3,aes(col=LOCA))+
xlab(paste("PCA 1 (",round(pca$varprop[1]*100,2),"% )",sep=""))+
ylab(paste("PCA 2 (",round(pca$varprop[2]*100,2),"% )",sep=""))+
scale_colour_manual(name="Location",
values=c(color_med_atl[2],
color_med_atl[1],
color_med_atl[3],
color_med_atl[4]))
p1<-p
p<-ggplot(data=data_pca,aes(x=PC3,y=PC4,label=INDIV))+
theme_minimal()+
theme(panel.grid=element_blank(),
panel.border=element_rect(fill="transparent"),
plot.title=element_text(hjust=0.5))+
geom_hline(yintercept=0,lty=2)+
geom_vline(xintercept=0,lty=2)+
geom_point(size=3,aes(col=LOCA))+
xlab(paste("PCA 3 (",round(pca$varprop[3]*100,2),"% )",sep=""))+
ylab(paste("PCA 4 (",round(pca$varprop[4]*100,2),"% )",sep=""))+
scale_colour_manual(name="Location",
values=c(color_med_atl[2],
color_med_atl[1],
color_med_atl[3],
color_med_atl[4]))
p2<-p
data_varpop=data.frame(PC=factor(paste("P",seq(1,10),sep=""),levels=paste("P",seq(1,10),sep="")),VAR=pca$varprop[1:10])
pp<-ggplot(data_varpop,aes(x=PC,y=VAR))+
geom_bar(stat='identity',fill="dodgerblue2",alpha=0.25)+
theme_classic()+
xlab("Principal Component")+
ylab("Variation explained (%)")
```
```{r}
subplot(ggplotly(p1)%>% layout(legend = list(orientation = "h", x = 0.2, y =-0.15)), ggplotly(p2)%>%hide_legend(), ggplotly(pp)%>%hide_legend(), titleX=T,titleY=T,margin=0.035,widths=c(0.375,0.425,0.2),which_layout=1) %>% partial_bundle()
```
### maf = 0.25
```{r}
pca=PCA_list$Prune_filtered$maf0.25[[1]]
data_pca=data.frame(INDIV=pca$sample.id,
PC1=pca$eigenvect[,1],
PC2=pca$eigenvect[,2],
PC3=pca$eigenvect[,3],
PC4=pca$eigenvect[,4],
LOCA=c(rep("Algarve",5),
rep("Bay of Biscay",5),
rep("Gulf of Lion",5),
rep("Costa Calida",5)))
color_med_atl=rev(brewer.pal(n=4,name="RdBu"))
p<-ggplot(data=data_pca,aes(x=PC1,y=PC2,label=INDIV))+
theme_minimal()+
theme(panel.grid=element_blank(),
panel.border=element_rect(fill="transparent"),
plot.title=element_text(hjust=0.5))+
geom_hline(yintercept=0,lty=2)+
geom_vline(xintercept=0,lty=2)+
geom_point(size=3,aes(col=LOCA))+
xlab(paste("PCA 1 (",round(pca$varprop[1]*100,2),"% )",sep=""))+
ylab(paste("PCA 2 (",round(pca$varprop[2]*100,2),"% )",sep=""))+
scale_colour_manual(name="Location",
values=c(color_med_atl[2],
color_med_atl[1],
color_med_atl[3],
color_med_atl[4]))
p1<-p
p<-ggplot(data=data_pca,aes(x=PC3,y=PC4,label=INDIV))+
theme_minimal()+
theme(panel.grid=element_blank(),
panel.border=element_rect(fill="transparent"),
plot.title=element_text(hjust=0.5))+
geom_hline(yintercept=0,lty=2)+
geom_vline(xintercept=0,lty=2)+
geom_point(size=3,aes(col=LOCA))+
xlab(paste("PCA 3 (",round(pca$varprop[3]*100,2),"% )",sep=""))+
ylab(paste("PCA 4 (",round(pca$varprop[4]*100,2),"% )",sep=""))+
scale_colour_manual(name="Location",
values=c(color_med_atl[2],
color_med_atl[1],
color_med_atl[3],
color_med_atl[4]))
p2<-p
data_varpop=data.frame(PC=factor(paste("P",seq(1,10),sep=""),levels=paste("P",seq(1,10),sep="")),VAR=pca$varprop[1:10])
pp<-ggplot(data_varpop,aes(x=PC,y=VAR))+
geom_bar(stat='identity',fill="dodgerblue2",alpha=0.25)+
theme_classic()+
xlab("Principal Component")+
ylab("Variation explained (%)")
```
```{r}
subplot(ggplotly(p1)%>% layout(legend = list(orientation = "h", x = 0.2, y =-0.15)), ggplotly(p2)%>%hide_legend(), ggplotly(pp)%>%hide_legend(), titleX=T,titleY=T,margin=0.035,widths=c(0.375,0.425,0.2),which_layout=1) %>% partial_bundle()
```
### maf = 0.30
```{r}
pca=PCA_list$Prune_filtered$maf0.3[[1]]
data_pca=data.frame(INDIV=pca$sample.id,
PC1=pca$eigenvect[,1],
PC2=pca$eigenvect[,2],
PC3=pca$eigenvect[,3],
PC4=pca$eigenvect[,4],
LOCA=c(rep("Algarve",5),
rep("Bay of Biscay",5),
rep("Gulf of Lion",5),
rep("Costa Calida",5)))
color_med_atl=rev(brewer.pal(n=4,name="RdBu"))
p<-ggplot(data=data_pca,aes(x=PC1,y=PC2,label=INDIV))+
theme_minimal()+
theme(panel.grid=element_blank(),
panel.border=element_rect(fill="transparent"),
plot.title=element_text(hjust=0.5))+
geom_hline(yintercept=0,lty=2)+
geom_vline(xintercept=0,lty=2)+
geom_point(size=3,aes(col=LOCA))+
xlab(paste("PCA 1 (",round(pca$varprop[1]*100,2),"% )",sep=""))+
ylab(paste("PCA 2 (",round(pca$varprop[2]*100,2),"% )",sep=""))+
scale_colour_manual(name="Location",
values=c(color_med_atl[2],
color_med_atl[1],
color_med_atl[3],
color_med_atl[4]))
p1<-p
p<-ggplot(data=data_pca,aes(x=PC3,y=PC4,label=INDIV))+
theme_minimal()+
theme(panel.grid=element_blank(),
panel.border=element_rect(fill="transparent"),
plot.title=element_text(hjust=0.5))+
geom_hline(yintercept=0,lty=2)+
geom_vline(xintercept=0,lty=2)+
geom_point(size=3,aes(col=LOCA))+
xlab(paste("PCA 3 (",round(pca$varprop[3]*100,2),"% )",sep=""))+
ylab(paste("PCA 4 (",round(pca$varprop[4]*100,2),"% )",sep=""))+
scale_colour_manual(name="Location",
values=c(color_med_atl[2],
color_med_atl[1],
color_med_atl[3],
color_med_atl[4]))
p2<-p
data_varpop=data.frame(PC=factor(paste("P",seq(1,10),sep=""),levels=paste("P",seq(1,10),sep="")),VAR=pca$varprop[1:10])
pp<-ggplot(data_varpop,aes(x=PC,y=VAR))+
geom_bar(stat='identity',fill="dodgerblue2",alpha=0.25)+
theme_classic()+
xlab("Principal Component")+
ylab("Variation explained (%)")
```
```{r}
subplot(ggplotly(p1)%>% layout(legend = list(orientation = "h", x = 0.2, y =-0.15)), ggplotly(p2)%>%hide_legend(), ggplotly(pp)%>%hide_legend(), titleX=T,titleY=T,margin=0.035,widths=c(0.375,0.425,0.2),which_layout=1) %>% partial_bundle()
```
### maf = 0.35
```{r}
pca=PCA_list$Prune_filtered$maf0.35[[1]]
data_pca=data.frame(INDIV=pca$sample.id,
PC1=pca$eigenvect[,1],
PC2=pca$eigenvect[,2],
PC3=pca$eigenvect[,3],
PC4=pca$eigenvect[,4],
LOCA=c(rep("Algarve",5),
rep("Bay of Biscay",5),
rep("Gulf of Lion",5),
rep("Costa Calida",5)))
color_med_atl=rev(brewer.pal(n=4,name="RdBu"))
p<-ggplot(data=data_pca,aes(x=PC1,y=PC2,label=INDIV))+
theme_minimal()+
theme(panel.grid=element_blank(),
panel.border=element_rect(fill="transparent"),
plot.title=element_text(hjust=0.5))+
geom_hline(yintercept=0,lty=2)+
geom_vline(xintercept=0,lty=2)+
geom_point(size=3,aes(col=LOCA))+
xlab(paste("PCA 1 (",round(pca$varprop[1]*100,2),"% )",sep=""))+
ylab(paste("PCA 2 (",round(pca$varprop[2]*100,2),"% )",sep=""))+
scale_colour_manual(name="Location",
values=c(color_med_atl[2],
color_med_atl[1],
color_med_atl[3],
color_med_atl[4]))
p1<-p
p<-ggplot(data=data_pca,aes(x=PC3,y=PC4,label=INDIV))+
theme_minimal()+
theme(panel.grid=element_blank(),
panel.border=element_rect(fill="transparent"),
plot.title=element_text(hjust=0.5))+
geom_hline(yintercept=0,lty=2)+
geom_vline(xintercept=0,lty=2)+
geom_point(size=3,aes(col=LOCA))+
xlab(paste("PCA 3 (",round(pca$varprop[3]*100,2),"% )",sep=""))+
ylab(paste("PCA 4 (",round(pca$varprop[4]*100,2),"% )",sep=""))+
scale_colour_manual(name="Location",
values=c(color_med_atl[2],
color_med_atl[1],
color_med_atl[3],
color_med_atl[4]))
p2<-p
data_varpop=data.frame(PC=factor(paste("P",seq(1,10),sep=""),levels=paste("P",seq(1,10),sep="")),VAR=pca$varprop[1:10])
pp<-ggplot(data_varpop,aes(x=PC,y=VAR))+
geom_bar(stat='identity',fill="dodgerblue2",alpha=0.25)+
theme_classic()+
xlab("Principal Component")+
ylab("Variation explained (%)")
```
```{r}
subplot(ggplotly(p1)%>% layout(legend = list(orientation = "h", x = 0.2, y =-0.15)), ggplotly(p2)%>%hide_legend(), ggplotly(pp)%>%hide_legend(), titleX=T,titleY=T,margin=0.035,widths=c(0.375,0.425,0.2),which_layout=1) %>% partial_bundle()
```
### maf = 0.40
```{r}
pca=PCA_list$Prune_filtered$maf0.4[[1]]
data_pca=data.frame(INDIV=pca$sample.id,
PC1=pca$eigenvect[,1],
PC2=pca$eigenvect[,2],
PC3=pca$eigenvect[,3],
PC4=pca$eigenvect[,4],
LOCA=c(rep("Algarve",5),
rep("Bay of Biscay",5),
rep("Gulf of Lion",5),
rep("Costa Calida",5)))
color_med_atl=rev(brewer.pal(n=4,name="RdBu"))
p<-ggplot(data=data_pca,aes(x=PC1,y=PC2,label=INDIV))+
theme_minimal()+
theme(panel.grid=element_blank(),
panel.border=element_rect(fill="transparent"),
plot.title=element_text(hjust=0.5))+
geom_hline(yintercept=0,lty=2)+
geom_vline(xintercept=0,lty=2)+
geom_point(size=3,aes(col=LOCA))+
xlab(paste("PCA 1 (",round(pca$varprop[1]*100,2),"% )",sep=""))+
ylab(paste("PCA 2 (",round(pca$varprop[2]*100,2),"% )",sep=""))+
scale_colour_manual(name="Location",
values=c(color_med_atl[2],
color_med_atl[1],
color_med_atl[3],
color_med_atl[4]))
p1<-p
p<-ggplot(data=data_pca,aes(x=PC3,y=PC4,label=INDIV))+
theme_minimal()+
theme(panel.grid=element_blank(),
panel.border=element_rect(fill="transparent"),
plot.title=element_text(hjust=0.5))+
geom_hline(yintercept=0,lty=2)+
geom_vline(xintercept=0,lty=2)+
geom_point(size=3,aes(col=LOCA))+
xlab(paste("PCA 3 (",round(pca$varprop[3]*100,2),"% )",sep=""))+
ylab(paste("PCA 4 (",round(pca$varprop[4]*100,2),"% )",sep=""))+
scale_colour_manual(name="Location",
values=c(color_med_atl[2],
color_med_atl[1],
color_med_atl[3],
color_med_atl[4]))
p2<-p
data_varpop=data.frame(PC=factor(paste("P",seq(1,10),sep=""),levels=paste("P",seq(1,10),sep="")),VAR=pca$varprop[1:10])
pp<-ggplot(data_varpop,aes(x=PC,y=VAR))+
geom_bar(stat='identity',fill="dodgerblue2",alpha=0.25)+
theme_classic()+
xlab("Principal Component")+
ylab("Variation explained (%)")
```
```{r}
subplot(ggplotly(p1)%>% layout(legend = list(orientation = "h", x = 0.2, y =-0.15)), ggplotly(p2)%>%hide_legend(), ggplotly(pp)%>%hide_legend(), titleX=T,titleY=T,margin=0.035,widths=c(0.375,0.425,0.2),which_layout=1) %>% partial_bundle()
```
### maf = 0.45
```{r}
pca=PCA_list$Prune_filtered$maf0.45[[1]]
data_pca=data.frame(INDIV=pca$sample.id,
PC1=pca$eigenvect[,1],
PC2=pca$eigenvect[,2],
PC3=pca$eigenvect[,3],
PC4=pca$eigenvect[,4],
LOCA=c(rep("Algarve",5),
rep("Bay of Biscay",5),
rep("Gulf of Lion",5),
rep("Costa Calida",5)))
color_med_atl=rev(brewer.pal(n=4,name="RdBu"))
p<-ggplot(data=data_pca,aes(x=PC1,y=PC2,label=INDIV))+
theme_minimal()+
theme(panel.grid=element_blank(),
panel.border=element_rect(fill="transparent"),
plot.title=element_text(hjust=0.5))+
geom_hline(yintercept=0,lty=2)+
geom_vline(xintercept=0,lty=2)+
geom_point(size=3,aes(col=LOCA))+
xlab(paste("PCA 1 (",round(pca$varprop[1]*100,2),"% )",sep=""))+
ylab(paste("PCA 2 (",round(pca$varprop[2]*100,2),"% )",sep=""))+
scale_colour_manual(name="Location",
values=c(color_med_atl[2],
color_med_atl[1],
color_med_atl[3],
color_med_atl[4]))
p1<-p
p<-ggplot(data=data_pca,aes(x=PC3,y=PC4,label=INDIV))+
theme_minimal()+
theme(panel.grid=element_blank(),
panel.border=element_rect(fill="transparent"),
plot.title=element_text(hjust=0.5))+
geom_hline(yintercept=0,lty=2)+
geom_vline(xintercept=0,lty=2)+
geom_point(size=3,aes(col=LOCA))+
xlab(paste("PCA 3 (",round(pca$varprop[3]*100,2),"% )",sep=""))+
ylab(paste("PCA 4 (",round(pca$varprop[4]*100,2),"% )",sep=""))+
scale_colour_manual(name="Location",
values=c(color_med_atl[2],
color_med_atl[1],
color_med_atl[3],
color_med_atl[4]))
p2<-p
data_varpop=data.frame(PC=factor(paste("P",seq(1,10),sep=""),levels=paste("P",seq(1,10),sep="")),VAR=pca$varprop[1:10])
pp<-ggplot(data_varpop,aes(x=PC,y=VAR))+
geom_bar(stat='identity',fill="dodgerblue2",alpha=0.25)+
theme_classic()+
xlab("Principal Component")+
ylab("Variation explained (%)")
```
```{r}
subplot(ggplotly(p1)%>% layout(legend = list(orientation = "h", x = 0.2, y =-0.15)), ggplotly(p2)%>%hide_legend(), ggplotly(pp)%>%hide_legend(), titleX=T,titleY=T,margin=0.035,widths=c(0.375,0.425,0.2),which_layout=1) %>% partial_bundle()
```
### maf = 0.50
```{r}
pca=PCA_list$Prune_filtered$maf0.5[[1]]
data_pca=data.frame(INDIV=pca$sample.id,
PC1=pca$eigenvect[,1],
PC2=pca$eigenvect[,2],
PC3=pca$eigenvect[,3],
PC4=pca$eigenvect[,4],
LOCA=c(rep("Algarve",5),
rep("Bay of Biscay",5),
rep("Gulf of Lion",5),
rep("Costa Calida",5)))
color_med_atl=rev(brewer.pal(n=4,name="RdBu"))
p<-ggplot(data=data_pca,aes(x=PC1,y=PC2,label=INDIV))+
theme_minimal()+
theme(panel.grid=element_blank(),
panel.border=element_rect(fill="transparent"),
plot.title=element_text(hjust=0.5))+
geom_hline(yintercept=0,lty=2)+
geom_vline(xintercept=0,lty=2)+
geom_point(size=3,aes(col=LOCA))+
xlab(paste("PCA 1 (",round(pca$varprop[1]*100,2),"% )",sep=""))+
ylab(paste("PCA 2 (",round(pca$varprop[2]*100,2),"% )",sep=""))+
scale_colour_manual(name="Location",
values=c(color_med_atl[2],
color_med_atl[1],
color_med_atl[3],
color_med_atl[4]))
p1<-p
p<-ggplot(data=data_pca,aes(x=PC3,y=PC4,label=INDIV))+
theme_minimal()+
theme(panel.grid=element_blank(),
panel.border=element_rect(fill="transparent"),
plot.title=element_text(hjust=0.5))+
geom_hline(yintercept=0,lty=2)+
geom_vline(xintercept=0,lty=2)+
geom_point(size=3,aes(col=LOCA))+
xlab(paste("PCA 3 (",round(pca$varprop[3]*100,2),"% )",sep=""))+
ylab(paste("PCA 4 (",round(pca$varprop[4]*100,2),"% )",sep=""))+
scale_colour_manual(name="Location",
values=c(color_med_atl[2],
color_med_atl[1],
color_med_atl[3],
color_med_atl[4]))
p2<-p
data_varpop=data.frame(PC=factor(paste("P",seq(1,10),sep=""),levels=paste("P",seq(1,10),sep="")),VAR=pca$varprop[1:10])
pp<-ggplot(data_varpop,aes(x=PC,y=VAR))+
geom_bar(stat='identity',fill="dodgerblue2",alpha=0.25)+
theme_classic()+
xlab("Principal Component")+
ylab("Variation explained (%)")
```
```{r}
subplot(ggplotly(p1)%>% layout(legend = list(orientation = "h", x = 0.2, y =-0.15)), ggplotly(p2)%>%hide_legend(), ggplotly(pp)%>%hide_legend(), titleX=T,titleY=T,margin=0.035,widths=c(0.375,0.425,0.2),which_layout=1) %>% partial_bundle()
```
Row {.tabset data-height=50}
-----------------------
<center>
<font size="6">**All unfiltered SNPS**</font>
</center>
Row {.tabset data-height=600}
-----------------------
### maf = 0
```{r}
pca=PCA_list$All_unfiltered$maf0[[1]]
data_pca=data.frame(INDIV=pca$sample.id,
PC1=pca$eigenvect[,1],
PC2=pca$eigenvect[,2],
PC3=pca$eigenvect[,3],
PC4=pca$eigenvect[,4],
LOCA=c(rep("Algarve",5),
rep("Bay of Biscay",5),
rep("Gulf of Lion",5),
rep("Costa Calida",5)))
color_med_atl=rev(brewer.pal(n=4,name="RdBu"))
p<-ggplot(data=data_pca,aes(x=PC1,y=PC2,label=INDIV))+
theme_minimal()+
theme(panel.grid=element_blank(),
panel.border=element_rect(fill="transparent"),
plot.title=element_text(hjust=0.5))+
geom_hline(yintercept=0,lty=2)+
geom_vline(xintercept=0,lty=2)+
geom_point(size=3,aes(col=LOCA))+
xlab(paste("PCA 1 (",round(pca$varprop[1]*100,2),"% )",sep=""))+
ylab(paste("PCA 2 (",round(pca$varprop[2]*100,2),"% )",sep=""))+
scale_colour_manual(name="Location",
values=c(color_med_atl[2],
color_med_atl[1],
color_med_atl[3],
color_med_atl[4]))
p1<-p
p<-ggplot(data=data_pca,aes(x=PC3,y=PC4,label=INDIV))+
theme_minimal()+
theme(panel.grid=element_blank(),
panel.border=element_rect(fill="transparent"),
plot.title=element_text(hjust=0.5))+
geom_hline(yintercept=0,lty=2)+
geom_vline(xintercept=0,lty=2)+
geom_point(size=3,aes(col=LOCA))+
xlab(paste("PCA 3 (",round(pca$varprop[3]*100,2),"% )",sep=""))+
ylab(paste("PCA 4 (",round(pca$varprop[4]*100,2),"% )",sep=""))+
scale_colour_manual(name="Location",
values=c(color_med_atl[2],
color_med_atl[1],
color_med_atl[3],
color_med_atl[4]))
p2<-p
data_varpop=data.frame(PC=factor(paste("P",seq(1,10),sep=""),levels=paste("P",seq(1,10),sep="")),VAR=pca$varprop[1:10])
pp<-ggplot(data_varpop,aes(x=PC,y=VAR))+
geom_bar(stat='identity',fill="dodgerblue2",alpha=0.25)+
theme_classic()+
xlab("Principal Component")+
ylab("Variation explained (%)")
```
```{r}
subplot(ggplotly(p1)%>% layout(legend = list(orientation = "h", x = 0.2, y =-0.15)), ggplotly(p2)%>%hide_legend(), ggplotly(pp)%>%hide_legend(), titleX=T,titleY=T,margin=0.035,widths=c(0.375,0.425,0.2),which_layout=1) %>% partial_bundle()
```
### maf = 0.05
```{r}
pca=PCA_list$All_unfiltered$maf0.05[[1]]
data_pca=data.frame(INDIV=pca$sample.id,
PC1=pca$eigenvect[,1],
PC2=pca$eigenvect[,2],
PC3=pca$eigenvect[,3],
PC4=pca$eigenvect[,4],
LOCA=c(rep("Algarve",5),
rep("Bay of Biscay",5),
rep("Gulf of Lion",5),
rep("Costa Calida",5)))
color_med_atl=rev(brewer.pal(n=4,name="RdBu"))
p<-ggplot(data=data_pca,aes(x=PC1,y=PC2,label=INDIV))+
theme_minimal()+
theme(panel.grid=element_blank(),
panel.border=element_rect(fill="transparent"),
plot.title=element_text(hjust=0.5))+
geom_hline(yintercept=0,lty=2)+
geom_vline(xintercept=0,lty=2)+
geom_point(size=3,aes(col=LOCA))+
xlab(paste("PCA 1 (",round(pca$varprop[1]*100,2),"% )",sep=""))+
ylab(paste("PCA 2 (",round(pca$varprop[2]*100,2),"% )",sep=""))+
scale_colour_manual(name="Location",
values=c(color_med_atl[2],
color_med_atl[1],
color_med_atl[3],
color_med_atl[4]))
p1<-p
p<-ggplot(data=data_pca,aes(x=PC3,y=PC4,label=INDIV))+
theme_minimal()+
theme(panel.grid=element_blank(),
panel.border=element_rect(fill="transparent"),
plot.title=element_text(hjust=0.5))+
geom_hline(yintercept=0,lty=2)+
geom_vline(xintercept=0,lty=2)+
geom_point(size=3,aes(col=LOCA))+
xlab(paste("PCA 3 (",round(pca$varprop[3]*100,2),"% )",sep=""))+
ylab(paste("PCA 4 (",round(pca$varprop[4]*100,2),"% )",sep=""))+
scale_colour_manual(name="Location",
values=c(color_med_atl[2],
color_med_atl[1],
color_med_atl[3],
color_med_atl[4]))
p2<-p
data_varpop=data.frame(PC=factor(paste("P",seq(1,10),sep=""),levels=paste("P",seq(1,10),sep="")),VAR=pca$varprop[1:10])
pp<-ggplot(data_varpop,aes(x=PC,y=VAR))+
geom_bar(stat='identity',fill="dodgerblue2",alpha=0.25)+
theme_classic()+
xlab("Principal Component")+
ylab("Variation explained (%)")
```
```{r}
subplot(ggplotly(p1)%>% layout(legend = list(orientation = "h", x = 0.2, y =-0.15)), ggplotly(p2)%>%hide_legend(), ggplotly(pp)%>%hide_legend(), titleX=T,titleY=T,margin=0.035,widths=c(0.375,0.425,0.2),which_layout=1) %>% partial_bundle()
```
### maf = 0.1
```{r}
pca=PCA_list$All_unfiltered$maf0.1[[1]]
data_pca=data.frame(INDIV=pca$sample.id,
PC1=pca$eigenvect[,1],
PC2=pca$eigenvect[,2],
PC3=pca$eigenvect[,3],
PC4=pca$eigenvect[,4],
LOCA=c(rep("Algarve",5),
rep("Bay of Biscay",5),
rep("Gulf of Lion",5),
rep("Costa Calida",5)))
color_med_atl=rev(brewer.pal(n=4,name="RdBu"))
p<-ggplot(data=data_pca,aes(x=PC1,y=PC2,label=INDIV))+
theme_minimal()+
theme(panel.grid=element_blank(),
panel.border=element_rect(fill="transparent"),
plot.title=element_text(hjust=0.5))+
geom_hline(yintercept=0,lty=2)+
geom_vline(xintercept=0,lty=2)+
geom_point(size=3,aes(col=LOCA))+
xlab(paste("PCA 1 (",round(pca$varprop[1]*100,2),"% )",sep=""))+
ylab(paste("PCA 2 (",round(pca$varprop[2]*100,2),"% )",sep=""))+
scale_colour_manual(name="Location",
values=c(color_med_atl[2],
color_med_atl[1],
color_med_atl[3],
color_med_atl[4]))
p1<-p
p<-ggplot(data=data_pca,aes(x=PC3,y=PC4,label=INDIV))+
theme_minimal()+
theme(panel.grid=element_blank(),
panel.border=element_rect(fill="transparent"),
plot.title=element_text(hjust=0.5))+
geom_hline(yintercept=0,lty=2)+
geom_vline(xintercept=0,lty=2)+
geom_point(size=3,aes(col=LOCA))+
xlab(paste("PCA 3 (",round(pca$varprop[3]*100,2),"% )",sep=""))+
ylab(paste("PCA 4 (",round(pca$varprop[4]*100,2),"% )",sep=""))+
scale_colour_manual(name="Location",
values=c(color_med_atl[2],
color_med_atl[1],
color_med_atl[3],
color_med_atl[4]))
p2<-p
data_varpop=data.frame(PC=factor(paste("P",seq(1,10),sep=""),levels=paste("P",seq(1,10),sep="")),VAR=pca$varprop[1:10])
pp<-ggplot(data_varpop,aes(x=PC,y=VAR))+
geom_bar(stat='identity',fill="dodgerblue2",alpha=0.25)+
theme_classic()+
xlab("Principal Component")+
ylab("Variation explained (%)")
```
```{r}
subplot(ggplotly(p1)%>% layout(legend = list(orientation = "h", x = 0.2, y =-0.15)), ggplotly(p2)%>%hide_legend(), ggplotly(pp)%>%hide_legend(), titleX=T,titleY=T,margin=0.035,widths=c(0.375,0.425,0.2),which_layout=1) %>% partial_bundle()
```
### maf = 0.15
```{r}
pca=PCA_list$All_unfiltered$maf0.15[[1]]
data_pca=data.frame(INDIV=pca$sample.id,
PC1=pca$eigenvect[,1],
PC2=pca$eigenvect[,2],
PC3=pca$eigenvect[,3],
PC4=pca$eigenvect[,4],
LOCA=c(rep("Algarve",5),
rep("Bay of Biscay",5),
rep("Gulf of Lion",5),
rep("Costa Calida",5)))
color_med_atl=rev(brewer.pal(n=4,name="RdBu"))
p<-ggplot(data=data_pca,aes(x=PC1,y=PC2,label=INDIV))+
theme_minimal()+
theme(panel.grid=element_blank(),
panel.border=element_rect(fill="transparent"),
plot.title=element_text(hjust=0.5))+
geom_hline(yintercept=0,lty=2)+
geom_vline(xintercept=0,lty=2)+
geom_point(size=3,aes(col=LOCA))+
xlab(paste("PCA 1 (",round(pca$varprop[1]*100,2),"% )",sep=""))+
ylab(paste("PCA 2 (",round(pca$varprop[2]*100,2),"% )",sep=""))+
scale_colour_manual(name="Location",
values=c(color_med_atl[2],
color_med_atl[1],
color_med_atl[3],
color_med_atl[4]))
p1<-p
p<-ggplot(data=data_pca,aes(x=PC3,y=PC4,label=INDIV))+
theme_minimal()+
theme(panel.grid=element_blank(),
panel.border=element_rect(fill="transparent"),
plot.title=element_text(hjust=0.5))+
geom_hline(yintercept=0,lty=2)+
geom_vline(xintercept=0,lty=2)+
geom_point(size=3,aes(col=LOCA))+
xlab(paste("PCA 3 (",round(pca$varprop[3]*100,2),"% )",sep=""))+
ylab(paste("PCA 4 (",round(pca$varprop[4]*100,2),"% )",sep=""))+
scale_colour_manual(name="Location",
values=c(color_med_atl[2],
color_med_atl[1],
color_med_atl[3],
color_med_atl[4]))
p2<-p
data_varpop=data.frame(PC=factor(paste("P",seq(1,10),sep=""),levels=paste("P",seq(1,10),sep="")),VAR=pca$varprop[1:10])
pp<-ggplot(data_varpop,aes(x=PC,y=VAR))+
geom_bar(stat='identity',fill="dodgerblue2",alpha=0.25)+
theme_classic()+
xlab("Principal Component")+
ylab("Variation explained (%)")
```
```{r}
subplot(ggplotly(p1)%>% layout(legend = list(orientation = "h", x = 0.2, y =-0.15)), ggplotly(p2)%>%hide_legend(), ggplotly(pp)%>%hide_legend(), titleX=T,titleY=T,margin=0.035,widths=c(0.375,0.425,0.2),which_layout=1) %>% partial_bundle()
```
### maf = 0.20
```{r}
pca=PCA_list$All_unfiltered$maf0.2[[1]]
data_pca=data.frame(INDIV=pca$sample.id,
PC1=pca$eigenvect[,1],
PC2=pca$eigenvect[,2],
PC3=pca$eigenvect[,3],
PC4=pca$eigenvect[,4],
LOCA=c(rep("Algarve",5),
rep("Bay of Biscay",5),
rep("Gulf of Lion",5),
rep("Costa Calida",5)))
color_med_atl=rev(brewer.pal(n=4,name="RdBu"))
p<-ggplot(data=data_pca,aes(x=PC1,y=PC2,label=INDIV))+
theme_minimal()+
theme(panel.grid=element_blank(),
panel.border=element_rect(fill="transparent"),
plot.title=element_text(hjust=0.5))+
geom_hline(yintercept=0,lty=2)+
geom_vline(xintercept=0,lty=2)+
geom_point(size=3,aes(col=LOCA))+
xlab(paste("PCA 1 (",round(pca$varprop[1]*100,2),"% )",sep=""))+
ylab(paste("PCA 2 (",round(pca$varprop[2]*100,2),"% )",sep=""))+
scale_colour_manual(name="Location",
values=c(color_med_atl[2],
color_med_atl[1],
color_med_atl[3],
color_med_atl[4]))
p1<-p
p<-ggplot(data=data_pca,aes(x=PC3,y=PC4,label=INDIV))+
theme_minimal()+
theme(panel.grid=element_blank(),
panel.border=element_rect(fill="transparent"),
plot.title=element_text(hjust=0.5))+
geom_hline(yintercept=0,lty=2)+
geom_vline(xintercept=0,lty=2)+
geom_point(size=3,aes(col=LOCA))+
xlab(paste("PCA 3 (",round(pca$varprop[3]*100,2),"% )",sep=""))+
ylab(paste("PCA 4 (",round(pca$varprop[4]*100,2),"% )",sep=""))+
scale_colour_manual(name="Location",
values=c(color_med_atl[2],
color_med_atl[1],
color_med_atl[3],
color_med_atl[4]))
p2<-p
data_varpop=data.frame(PC=factor(paste("P",seq(1,10),sep=""),levels=paste("P",seq(1,10),sep="")),VAR=pca$varprop[1:10])
pp<-ggplot(data_varpop,aes(x=PC,y=VAR))+
geom_bar(stat='identity',fill="dodgerblue2",alpha=0.25)+
theme_classic()+
xlab("Principal Component")+
ylab("Variation explained (%)")
```
```{r}
subplot(ggplotly(p1)%>% layout(legend = list(orientation = "h", x = 0.2, y =-0.15)), ggplotly(p2)%>%hide_legend(), ggplotly(pp)%>%hide_legend(), titleX=T,titleY=T,margin=0.035,widths=c(0.375,0.425,0.2),which_layout=1) %>% partial_bundle()
```
### maf = 0.25
```{r}
pca=PCA_list$All_unfiltered$maf0.25[[1]]
data_pca=data.frame(INDIV=pca$sample.id,
PC1=pca$eigenvect[,1],
PC2=pca$eigenvect[,2],
PC3=pca$eigenvect[,3],
PC4=pca$eigenvect[,4],
LOCA=c(rep("Algarve",5),
rep("Bay of Biscay",5),
rep("Gulf of Lion",5),
rep("Costa Calida",5)))
color_med_atl=rev(brewer.pal(n=4,name="RdBu"))
p<-ggplot(data=data_pca,aes(x=PC1,y=PC2,label=INDIV))+
theme_minimal()+
theme(panel.grid=element_blank(),
panel.border=element_rect(fill="transparent"),
plot.title=element_text(hjust=0.5))+
geom_hline(yintercept=0,lty=2)+
geom_vline(xintercept=0,lty=2)+
geom_point(size=3,aes(col=LOCA))+
xlab(paste("PCA 1 (",round(pca$varprop[1]*100,2),"% )",sep=""))+
ylab(paste("PCA 2 (",round(pca$varprop[2]*100,2),"% )",sep=""))+
scale_colour_manual(name="Location",
values=c(color_med_atl[2],
color_med_atl[1],
color_med_atl[3],
color_med_atl[4]))
p1<-p
p<-ggplot(data=data_pca,aes(x=PC3,y=PC4,label=INDIV))+
theme_minimal()+
theme(panel.grid=element_blank(),
panel.border=element_rect(fill="transparent"),
plot.title=element_text(hjust=0.5))+
geom_hline(yintercept=0,lty=2)+
geom_vline(xintercept=0,lty=2)+
geom_point(size=3,aes(col=LOCA))+
xlab(paste("PCA 3 (",round(pca$varprop[3]*100,2),"% )",sep=""))+
ylab(paste("PCA 4 (",round(pca$varprop[4]*100,2),"% )",sep=""))+
scale_colour_manual(name="Location",
values=c(color_med_atl[2],
color_med_atl[1],
color_med_atl[3],
color_med_atl[4]))
p2<-p
data_varpop=data.frame(PC=factor(paste("P",seq(1,10),sep=""),levels=paste("P",seq(1,10),sep="")),VAR=pca$varprop[1:10])
pp<-ggplot(data_varpop,aes(x=PC,y=VAR))+
geom_bar(stat='identity',fill="dodgerblue2",alpha=0.25)+
theme_classic()+
xlab("Principal Component")+
ylab("Variation explained (%)")
```
```{r}
subplot(ggplotly(p1)%>% layout(legend = list(orientation = "h", x = 0.2, y =-0.15)), ggplotly(p2)%>%hide_legend(), ggplotly(pp)%>%hide_legend(), titleX=T,titleY=T,margin=0.035,widths=c(0.375,0.425,0.2),which_layout=1) %>% partial_bundle()
```
### maf = 0.30
```{r}
pca=PCA_list$All_unfiltered$maf0.3[[1]]
data_pca=data.frame(INDIV=pca$sample.id,
PC1=pca$eigenvect[,1],
PC2=pca$eigenvect[,2],
PC3=pca$eigenvect[,3],
PC4=pca$eigenvect[,4],
LOCA=c(rep("Algarve",5),
rep("Bay of Biscay",5),
rep("Gulf of Lion",5),
rep("Costa Calida",5)))
color_med_atl=rev(brewer.pal(n=4,name="RdBu"))
p<-ggplot(data=data_pca,aes(x=PC1,y=PC2,label=INDIV))+
theme_minimal()+
theme(panel.grid=element_blank(),
panel.border=element_rect(fill="transparent"),
plot.title=element_text(hjust=0.5))+
geom_hline(yintercept=0,lty=2)+
geom_vline(xintercept=0,lty=2)+
geom_point(size=3,aes(col=LOCA))+
xlab(paste("PCA 1 (",round(pca$varprop[1]*100,2),"% )",sep=""))+
ylab(paste("PCA 2 (",round(pca$varprop[2]*100,2),"% )",sep=""))+
scale_colour_manual(name="Location",
values=c(color_med_atl[2],
color_med_atl[1],
color_med_atl[3],
color_med_atl[4]))
p1<-p
p<-ggplot(data=data_pca,aes(x=PC3,y=PC4,label=INDIV))+
theme_minimal()+
theme(panel.grid=element_blank(),
panel.border=element_rect(fill="transparent"),
plot.title=element_text(hjust=0.5))+
geom_hline(yintercept=0,lty=2)+
geom_vline(xintercept=0,lty=2)+
geom_point(size=3,aes(col=LOCA))+
xlab(paste("PCA 3 (",round(pca$varprop[3]*100,2),"% )",sep=""))+
ylab(paste("PCA 4 (",round(pca$varprop[4]*100,2),"% )",sep=""))+
scale_colour_manual(name="Location",
values=c(color_med_atl[2],
color_med_atl[1],
color_med_atl[3],
color_med_atl[4]))
p2<-p
data_varpop=data.frame(PC=factor(paste("P",seq(1,10),sep=""),levels=paste("P",seq(1,10),sep="")),VAR=pca$varprop[1:10])
pp<-ggplot(data_varpop,aes(x=PC,y=VAR))+
geom_bar(stat='identity',fill="dodgerblue2",alpha=0.25)+
theme_classic()+
xlab("Principal Component")+
ylab("Variation explained (%)")
```
```{r}
subplot(ggplotly(p1)%>% layout(legend = list(orientation = "h", x = 0.2, y =-0.15)), ggplotly(p2)%>%hide_legend(), ggplotly(pp)%>%hide_legend(), titleX=T,titleY=T,margin=0.035,widths=c(0.375,0.425,0.2),which_layout=1) %>% partial_bundle()
```
### maf = 0.35
```{r}
pca=PCA_list$All_unfiltered$maf0.35[[1]]
data_pca=data.frame(INDIV=pca$sample.id,
PC1=pca$eigenvect[,1],
PC2=pca$eigenvect[,2],
PC3=pca$eigenvect[,3],
PC4=pca$eigenvect[,4],
LOCA=c(rep("Algarve",5),
rep("Bay of Biscay",5),
rep("Gulf of Lion",5),
rep("Costa Calida",5)))
color_med_atl=rev(brewer.pal(n=4,name="RdBu"))
p<-ggplot(data=data_pca,aes(x=PC1,y=PC2,label=INDIV))+
theme_minimal()+
theme(panel.grid=element_blank(),
panel.border=element_rect(fill="transparent"),
plot.title=element_text(hjust=0.5))+
geom_hline(yintercept=0,lty=2)+
geom_vline(xintercept=0,lty=2)+
geom_point(size=3,aes(col=LOCA))+
xlab(paste("PCA 1 (",round(pca$varprop[1]*100,2),"% )",sep=""))+
ylab(paste("PCA 2 (",round(pca$varprop[2]*100,2),"% )",sep=""))+
scale_colour_manual(name="Location",
values=c(color_med_atl[2],
color_med_atl[1],
color_med_atl[3],
color_med_atl[4]))
p1<-p
p<-ggplot(data=data_pca,aes(x=PC3,y=PC4,label=INDIV))+
theme_minimal()+
theme(panel.grid=element_blank(),
panel.border=element_rect(fill="transparent"),
plot.title=element_text(hjust=0.5))+
geom_hline(yintercept=0,lty=2)+
geom_vline(xintercept=0,lty=2)+
geom_point(size=3,aes(col=LOCA))+
xlab(paste("PCA 3 (",round(pca$varprop[3]*100,2),"% )",sep=""))+
ylab(paste("PCA 4 (",round(pca$varprop[4]*100,2),"% )",sep=""))+
scale_colour_manual(name="Location",
values=c(color_med_atl[2],
color_med_atl[1],
color_med_atl[3],
color_med_atl[4]))
p2<-p
data_varpop=data.frame(PC=factor(paste("P",seq(1,10),sep=""),levels=paste("P",seq(1,10),sep="")),VAR=pca$varprop[1:10])
pp<-ggplot(data_varpop,aes(x=PC,y=VAR))+
geom_bar(stat='identity',fill="dodgerblue2",alpha=0.25)+
theme_classic()+
xlab("Principal Component")+
ylab("Variation explained (%)")
```
```{r}
subplot(ggplotly(p1)%>% layout(legend = list(orientation = "h", x = 0.2, y =-0.15)), ggplotly(p2)%>%hide_legend(), ggplotly(pp)%>%hide_legend(), titleX=T,titleY=T,margin=0.035,widths=c(0.375,0.425,0.2),which_layout=1) %>% partial_bundle()
```
### maf = 0.40
```{r}
pca=PCA_list$All_unfiltered$maf0.4[[1]]
data_pca=data.frame(INDIV=pca$sample.id,
PC1=pca$eigenvect[,1],
PC2=pca$eigenvect[,2],
PC3=pca$eigenvect[,3],
PC4=pca$eigenvect[,4],
LOCA=c(rep("Algarve",5),
rep("Bay of Biscay",5),
rep("Gulf of Lion",5),
rep("Costa Calida",5)))
color_med_atl=rev(brewer.pal(n=4,name="RdBu"))
p<-ggplot(data=data_pca,aes(x=PC1,y=PC2,label=INDIV))+
theme_minimal()+
theme(panel.grid=element_blank(),
panel.border=element_rect(fill="transparent"),
plot.title=element_text(hjust=0.5))+
geom_hline(yintercept=0,lty=2)+
geom_vline(xintercept=0,lty=2)+
geom_point(size=3,aes(col=LOCA))+
xlab(paste("PCA 1 (",round(pca$varprop[1]*100,2),"% )",sep=""))+
ylab(paste("PCA 2 (",round(pca$varprop[2]*100,2),"% )",sep=""))+
scale_colour_manual(name="Location",
values=c(color_med_atl[2],
color_med_atl[1],
color_med_atl[3],
color_med_atl[4]))
p1<-p
p<-ggplot(data=data_pca,aes(x=PC3,y=PC4,label=INDIV))+
theme_minimal()+
theme(panel.grid=element_blank(),
panel.border=element_rect(fill="transparent"),
plot.title=element_text(hjust=0.5))+
geom_hline(yintercept=0,lty=2)+
geom_vline(xintercept=0,lty=2)+
geom_point(size=3,aes(col=LOCA))+
xlab(paste("PCA 3 (",round(pca$varprop[3]*100,2),"% )",sep=""))+
ylab(paste("PCA 4 (",round(pca$varprop[4]*100,2),"% )",sep=""))+
scale_colour_manual(name="Location",
values=c(color_med_atl[2],
color_med_atl[1],
color_med_atl[3],
color_med_atl[4]))
p2<-p
data_varpop=data.frame(PC=factor(paste("P",seq(1,10),sep=""),levels=paste("P",seq(1,10),sep="")),VAR=pca$varprop[1:10])
pp<-ggplot(data_varpop,aes(x=PC,y=VAR))+
geom_bar(stat='identity',fill="dodgerblue2",alpha=0.25)+
theme_classic()+
xlab("Principal Component")+
ylab("Variation explained (%)")
```
```{r}
subplot(ggplotly(p1)%>% layout(legend = list(orientation = "h", x = 0.2, y =-0.15)), ggplotly(p2)%>%hide_legend(), ggplotly(pp)%>%hide_legend(), titleX=T,titleY=T,margin=0.035,widths=c(0.375,0.425,0.2),which_layout=1) %>% partial_bundle()
```
### maf = 0.45
```{r}
pca=PCA_list$All_unfiltered$maf0.45[[1]]
data_pca=data.frame(INDIV=pca$sample.id,
PC1=pca$eigenvect[,1],
PC2=pca$eigenvect[,2],
PC3=pca$eigenvect[,3],
PC4=pca$eigenvect[,4],
LOCA=c(rep("Algarve",5),
rep("Bay of Biscay",5),
rep("Gulf of Lion",5),
rep("Costa Calida",5)))
color_med_atl=rev(brewer.pal(n=4,name="RdBu"))
p<-ggplot(data=data_pca,aes(x=PC1,y=PC2,label=INDIV))+
theme_minimal()+
theme(panel.grid=element_blank(),
panel.border=element_rect(fill="transparent"),
plot.title=element_text(hjust=0.5))+
geom_hline(yintercept=0,lty=2)+
geom_vline(xintercept=0,lty=2)+
geom_point(size=3,aes(col=LOCA))+
xlab(paste("PCA 1 (",round(pca$varprop[1]*100,2),"% )",sep=""))+
ylab(paste("PCA 2 (",round(pca$varprop[2]*100,2),"% )",sep=""))+
scale_colour_manual(name="Location",
values=c(color_med_atl[2],
color_med_atl[1],
color_med_atl[3],
color_med_atl[4]))
p1<-p
p<-ggplot(data=data_pca,aes(x=PC3,y=PC4,label=INDIV))+
theme_minimal()+
theme(panel.grid=element_blank(),
panel.border=element_rect(fill="transparent"),
plot.title=element_text(hjust=0.5))+
geom_hline(yintercept=0,lty=2)+
geom_vline(xintercept=0,lty=2)+
geom_point(size=3,aes(col=LOCA))+
xlab(paste("PCA 3 (",round(pca$varprop[3]*100,2),"% )",sep=""))+
ylab(paste("PCA 4 (",round(pca$varprop[4]*100,2),"% )",sep=""))+
scale_colour_manual(name="Location",
values=c(color_med_atl[2],
color_med_atl[1],
color_med_atl[3],
color_med_atl[4]))
p2<-p
data_varpop=data.frame(PC=factor(paste("P",seq(1,10),sep=""),levels=paste("P",seq(1,10),sep="")),VAR=pca$varprop[1:10])
pp<-ggplot(data_varpop,aes(x=PC,y=VAR))+
geom_bar(stat='identity',fill="dodgerblue2",alpha=0.25)+
theme_classic()+
xlab("Principal Component")+
ylab("Variation explained (%)")
```
```{r}
subplot(ggplotly(p1)%>% layout(legend = list(orientation = "h", x = 0.2, y =-0.15)), ggplotly(p2)%>%hide_legend(), ggplotly(pp)%>%hide_legend(), titleX=T,titleY=T,margin=0.035,widths=c(0.375,0.425,0.2),which_layout=1) %>% partial_bundle()
```
### maf = 0.50
```{r}
pca=PCA_list$All_unfiltered$maf0.5[[1]]
data_pca=data.frame(INDIV=pca$sample.id,
PC1=pca$eigenvect[,1],
PC2=pca$eigenvect[,2],
PC3=pca$eigenvect[,3],
PC4=pca$eigenvect[,4],
LOCA=c(rep("Algarve",5),
rep("Bay of Biscay",5),
rep("Gulf of Lion",5),
rep("Costa Calida",5)))
color_med_atl=rev(brewer.pal(n=4,name="RdBu"))
p<-ggplot(data=data_pca,aes(x=PC1,y=PC2,label=INDIV))+
theme_minimal()+
theme(panel.grid=element_blank(),
panel.border=element_rect(fill="transparent"),
plot.title=element_text(hjust=0.5))+
geom_hline(yintercept=0,lty=2)+
geom_vline(xintercept=0,lty=2)+
geom_point(size=3,aes(col=LOCA))+
xlab(paste("PCA 1 (",round(pca$varprop[1]*100,2),"% )",sep=""))+
ylab(paste("PCA 2 (",round(pca$varprop[2]*100,2),"% )",sep=""))+
scale_colour_manual(name="Location",
values=c(color_med_atl[2],
color_med_atl[1],
color_med_atl[3],
color_med_atl[4]))
p1<-p
p<-ggplot(data=data_pca,aes(x=PC3,y=PC4,label=INDIV))+
theme_minimal()+
theme(panel.grid=element_blank(),
panel.border=element_rect(fill="transparent"),
plot.title=element_text(hjust=0.5))+
geom_hline(yintercept=0,lty=2)+
geom_vline(xintercept=0,lty=2)+
geom_point(size=3,aes(col=LOCA))+
xlab(paste("PCA 3 (",round(pca$varprop[3]*100,2),"% )",sep=""))+
ylab(paste("PCA 4 (",round(pca$varprop[4]*100,2),"% )",sep=""))+
scale_colour_manual(name="Location",
values=c(color_med_atl[2],
color_med_atl[1],
color_med_atl[3],
color_med_atl[4]))
p2<-p
data_varpop=data.frame(PC=factor(paste("P",seq(1,10),sep=""),levels=paste("P",seq(1,10),sep="")),VAR=pca$varprop[1:10])
pp<-ggplot(data_varpop,aes(x=PC,y=VAR))+
geom_bar(stat='identity',fill="dodgerblue2",alpha=0.25)+
theme_classic()+
xlab("Principal Component")+
ylab("Variation explained (%)")
```
```{r}
subplot(ggplotly(p1)%>% layout(legend = list(orientation = "h", x = 0.2, y =-0.15)), ggplotly(p2)%>%hide_legend(), ggplotly(pp)%>%hide_legend(), titleX=T,titleY=T,margin=0.035,widths=c(0.375,0.425,0.2),which_layout=1) %>% partial_bundle()
```
Row {.tabset data-height=50}
-----------------------
<center>
<font size="6">**Pruned unfiltered SNPS**</font>
</center>
Row {.tabset data-height=600}
-----------------------
### maf = 0
```{r}
pca=PCA_list$Prune_unfiltered$maf0[[1]]
data_pca=data.frame(INDIV=pca$sample.id,
PC1=pca$eigenvect[,1],
PC2=pca$eigenvect[,2],
PC3=pca$eigenvect[,3],
PC4=pca$eigenvect[,4],
LOCA=c(rep("Algarve",5),
rep("Bay of Biscay",5),
rep("Gulf of Lion",5),
rep("Costa Calida",5)))
color_med_atl=rev(brewer.pal(n=4,name="RdBu"))
p<-ggplot(data=data_pca,aes(x=PC1,y=PC2,label=INDIV))+
theme_minimal()+
theme(panel.grid=element_blank(),
panel.border=element_rect(fill="transparent"),
plot.title=element_text(hjust=0.5))+
geom_hline(yintercept=0,lty=2)+
geom_vline(xintercept=0,lty=2)+
geom_point(size=3,aes(col=LOCA))+
xlab(paste("PCA 1 (",round(pca$varprop[1]*100,2),"% )",sep=""))+
ylab(paste("PCA 2 (",round(pca$varprop[2]*100,2),"% )",sep=""))+
scale_colour_manual(name="Location",
values=c(color_med_atl[2],
color_med_atl[1],
color_med_atl[3],
color_med_atl[4]))
p1<-p
p<-ggplot(data=data_pca,aes(x=PC3,y=PC4,label=INDIV))+
theme_minimal()+
theme(panel.grid=element_blank(),
panel.border=element_rect(fill="transparent"),
plot.title=element_text(hjust=0.5))+
geom_hline(yintercept=0,lty=2)+
geom_vline(xintercept=0,lty=2)+
geom_point(size=3,aes(col=LOCA))+
xlab(paste("PCA 3 (",round(pca$varprop[3]*100,2),"% )",sep=""))+
ylab(paste("PCA 4 (",round(pca$varprop[4]*100,2),"% )",sep=""))+
scale_colour_manual(name="Location",
values=c(color_med_atl[2],
color_med_atl[1],
color_med_atl[3],
color_med_atl[4]))
p2<-p
data_varpop=data.frame(PC=factor(paste("P",seq(1,10),sep=""),levels=paste("P",seq(1,10),sep="")),VAR=pca$varprop[1:10])
pp<-ggplot(data_varpop,aes(x=PC,y=VAR))+
geom_bar(stat='identity',fill="dodgerblue2",alpha=0.25)+
theme_classic()+
xlab("Principal Component")+
ylab("Variation explained (%)")
```
```{r}
subplot(ggplotly(p1)%>% layout(legend = list(orientation = "h", x = 0.2, y =-0.15)), ggplotly(p2)%>%hide_legend(), ggplotly(pp)%>%hide_legend(), titleX=T,titleY=T,margin=0.035,widths=c(0.375,0.425,0.2),which_layout=1) %>% partial_bundle()
```
### maf = 0.05
```{r}
pca=PCA_list$Prune_unfiltered$maf0.05[[1]]
data_pca=data.frame(INDIV=pca$sample.id,
PC1=pca$eigenvect[,1],
PC2=pca$eigenvect[,2],
PC3=pca$eigenvect[,3],
PC4=pca$eigenvect[,4],
LOCA=c(rep("Algarve",5),
rep("Bay of Biscay",5),
rep("Gulf of Lion",5),
rep("Costa Calida",5)))
color_med_atl=rev(brewer.pal(n=4,name="RdBu"))
p<-ggplot(data=data_pca,aes(x=PC1,y=PC2,label=INDIV))+
theme_minimal()+
theme(panel.grid=element_blank(),
panel.border=element_rect(fill="transparent"),
plot.title=element_text(hjust=0.5))+
geom_hline(yintercept=0,lty=2)+
geom_vline(xintercept=0,lty=2)+
geom_point(size=3,aes(col=LOCA))+
xlab(paste("PCA 1 (",round(pca$varprop[1]*100,2),"% )",sep=""))+
ylab(paste("PCA 2 (",round(pca$varprop[2]*100,2),"% )",sep=""))+
scale_colour_manual(name="Location",
values=c(color_med_atl[2],
color_med_atl[1],
color_med_atl[3],
color_med_atl[4]))
p1<-p
p<-ggplot(data=data_pca,aes(x=PC3,y=PC4,label=INDIV))+
theme_minimal()+
theme(panel.grid=element_blank(),
panel.border=element_rect(fill="transparent"),
plot.title=element_text(hjust=0.5))+
geom_hline(yintercept=0,lty=2)+
geom_vline(xintercept=0,lty=2)+
geom_point(size=3,aes(col=LOCA))+
xlab(paste("PCA 3 (",round(pca$varprop[3]*100,2),"% )",sep=""))+
ylab(paste("PCA 4 (",round(pca$varprop[4]*100,2),"% )",sep=""))+
scale_colour_manual(name="Location",
values=c(color_med_atl[2],
color_med_atl[1],
color_med_atl[3],
color_med_atl[4]))
p2<-p
data_varpop=data.frame(PC=factor(paste("P",seq(1,10),sep=""),levels=paste("P",seq(1,10),sep="")),VAR=pca$varprop[1:10])
pp<-ggplot(data_varpop,aes(x=PC,y=VAR))+
geom_bar(stat='identity',fill="dodgerblue2",alpha=0.25)+
theme_classic()+
xlab("Principal Component")+
ylab("Variation explained (%)")
```
```{r}
subplot(ggplotly(p1)%>% layout(legend = list(orientation = "h", x = 0.2, y =-0.15)), ggplotly(p2)%>%hide_legend(), ggplotly(pp)%>%hide_legend(), titleX=T,titleY=T,margin=0.035,widths=c(0.375,0.425,0.2),which_layout=1) %>% partial_bundle()
```
### maf = 0.1
```{r}
pca=PCA_list$Prune_unfiltered$maf0.1[[1]]
data_pca=data.frame(INDIV=pca$sample.id,
PC1=pca$eigenvect[,1],
PC2=pca$eigenvect[,2],
PC3=pca$eigenvect[,3],
PC4=pca$eigenvect[,4],
LOCA=c(rep("Algarve",5),
rep("Bay of Biscay",5),
rep("Gulf of Lion",5),
rep("Costa Calida",5)))
color_med_atl=rev(brewer.pal(n=4,name="RdBu"))
p<-ggplot(data=data_pca,aes(x=PC1,y=PC2,label=INDIV))+
theme_minimal()+
theme(panel.grid=element_blank(),
panel.border=element_rect(fill="transparent"),
plot.title=element_text(hjust=0.5))+
geom_hline(yintercept=0,lty=2)+
geom_vline(xintercept=0,lty=2)+
geom_point(size=3,aes(col=LOCA))+
xlab(paste("PCA 1 (",round(pca$varprop[1]*100,2),"% )",sep=""))+
ylab(paste("PCA 2 (",round(pca$varprop[2]*100,2),"% )",sep=""))+
scale_colour_manual(name="Location",
values=c(color_med_atl[2],
color_med_atl[1],
color_med_atl[3],
color_med_atl[4]))
p1<-p
p<-ggplot(data=data_pca,aes(x=PC3,y=PC4,label=INDIV))+
theme_minimal()+
theme(panel.grid=element_blank(),
panel.border=element_rect(fill="transparent"),
plot.title=element_text(hjust=0.5))+
geom_hline(yintercept=0,lty=2)+
geom_vline(xintercept=0,lty=2)+
geom_point(size=3,aes(col=LOCA))+
xlab(paste("PCA 3 (",round(pca$varprop[3]*100,2),"% )",sep=""))+
ylab(paste("PCA 4 (",round(pca$varprop[4]*100,2),"% )",sep=""))+
scale_colour_manual(name="Location",
values=c(color_med_atl[2],
color_med_atl[1],
color_med_atl[3],
color_med_atl[4]))
p2<-p
data_varpop=data.frame(PC=factor(paste("P",seq(1,10),sep=""),levels=paste("P",seq(1,10),sep="")),VAR=pca$varprop[1:10])
pp<-ggplot(data_varpop,aes(x=PC,y=VAR))+
geom_bar(stat='identity',fill="dodgerblue2",alpha=0.25)+
theme_classic()+
xlab("Principal Component")+
ylab("Variation explained (%)")
```
```{r}
subplot(ggplotly(p1)%>% layout(legend = list(orientation = "h", x = 0.2, y =-0.15)), ggplotly(p2)%>%hide_legend(), ggplotly(pp)%>%hide_legend(), titleX=T,titleY=T,margin=0.035,widths=c(0.375,0.425,0.2),which_layout=1) %>% partial_bundle()
```
### maf = 0.15
```{r}
pca=PCA_list$Prune_unfiltered$maf0.15[[1]]
data_pca=data.frame(INDIV=pca$sample.id,
PC1=pca$eigenvect[,1],
PC2=pca$eigenvect[,2],
PC3=pca$eigenvect[,3],
PC4=pca$eigenvect[,4],
LOCA=c(rep("Algarve",5),
rep("Bay of Biscay",5),
rep("Gulf of Lion",5),
rep("Costa Calida",5)))
color_med_atl=rev(brewer.pal(n=4,name="RdBu"))
p<-ggplot(data=data_pca,aes(x=PC1,y=PC2,label=INDIV))+
theme_minimal()+
theme(panel.grid=element_blank(),
panel.border=element_rect(fill="transparent"),
plot.title=element_text(hjust=0.5))+
geom_hline(yintercept=0,lty=2)+
geom_vline(xintercept=0,lty=2)+
geom_point(size=3,aes(col=LOCA))+
xlab(paste("PCA 1 (",round(pca$varprop[1]*100,2),"% )",sep=""))+
ylab(paste("PCA 2 (",round(pca$varprop[2]*100,2),"% )",sep=""))+
scale_colour_manual(name="Location",
values=c(color_med_atl[2],
color_med_atl[1],
color_med_atl[3],
color_med_atl[4]))
p1<-p
p<-ggplot(data=data_pca,aes(x=PC3,y=PC4,label=INDIV))+
theme_minimal()+
theme(panel.grid=element_blank(),
panel.border=element_rect(fill="transparent"),
plot.title=element_text(hjust=0.5))+
geom_hline(yintercept=0,lty=2)+
geom_vline(xintercept=0,lty=2)+
geom_point(size=3,aes(col=LOCA))+
xlab(paste("PCA 3 (",round(pca$varprop[3]*100,2),"% )",sep=""))+
ylab(paste("PCA 4 (",round(pca$varprop[4]*100,2),"% )",sep=""))+
scale_colour_manual(name="Location",
values=c(color_med_atl[2],
color_med_atl[1],
color_med_atl[3],
color_med_atl[4]))
p2<-p
data_varpop=data.frame(PC=factor(paste("P",seq(1,10),sep=""),levels=paste("P",seq(1,10),sep="")),VAR=pca$varprop[1:10])
pp<-ggplot(data_varpop,aes(x=PC,y=VAR))+
geom_bar(stat='identity',fill="dodgerblue2",alpha=0.25)+
theme_classic()+
xlab("Principal Component")+
ylab("Variation explained (%)")
```
```{r}
subplot(ggplotly(p1)%>% layout(legend = list(orientation = "h", x = 0.2, y =-0.15)), ggplotly(p2)%>%hide_legend(), ggplotly(pp)%>%hide_legend(), titleX=T,titleY=T,margin=0.035,widths=c(0.375,0.425,0.2),which_layout=1) %>% partial_bundle()
```
### maf = 0.20
```{r}
pca=PCA_list$Prune_unfiltered$maf0.2[[1]]
data_pca=data.frame(INDIV=pca$sample.id,
PC1=pca$eigenvect[,1],
PC2=pca$eigenvect[,2],
PC3=pca$eigenvect[,3],
PC4=pca$eigenvect[,4],
LOCA=c(rep("Algarve",5),
rep("Bay of Biscay",5),
rep("Gulf of Lion",5),
rep("Costa Calida",5)))
color_med_atl=rev(brewer.pal(n=4,name="RdBu"))
p<-ggplot(data=data_pca,aes(x=PC1,y=PC2,label=INDIV))+
theme_minimal()+
theme(panel.grid=element_blank(),
panel.border=element_rect(fill="transparent"),
plot.title=element_text(hjust=0.5))+
geom_hline(yintercept=0,lty=2)+
geom_vline(xintercept=0,lty=2)+
geom_point(size=3,aes(col=LOCA))+
xlab(paste("PCA 1 (",round(pca$varprop[1]*100,2),"% )",sep=""))+
ylab(paste("PCA 2 (",round(pca$varprop[2]*100,2),"% )",sep=""))+
scale_colour_manual(name="Location",
values=c(color_med_atl[2],
color_med_atl[1],
color_med_atl[3],
color_med_atl[4]))
p1<-p
p<-ggplot(data=data_pca,aes(x=PC3,y=PC4,label=INDIV))+
theme_minimal()+
theme(panel.grid=element_blank(),
panel.border=element_rect(fill="transparent"),
plot.title=element_text(hjust=0.5))+
geom_hline(yintercept=0,lty=2)+
geom_vline(xintercept=0,lty=2)+
geom_point(size=3,aes(col=LOCA))+
xlab(paste("PCA 3 (",round(pca$varprop[3]*100,2),"% )",sep=""))+
ylab(paste("PCA 4 (",round(pca$varprop[4]*100,2),"% )",sep=""))+
scale_colour_manual(name="Location",
values=c(color_med_atl[2],
color_med_atl[1],
color_med_atl[3],
color_med_atl[4]))
p2<-p
data_varpop=data.frame(PC=factor(paste("P",seq(1,10),sep=""),levels=paste("P",seq(1,10),sep="")),VAR=pca$varprop[1:10])
pp<-ggplot(data_varpop,aes(x=PC,y=VAR))+
geom_bar(stat='identity',fill="dodgerblue2",alpha=0.25)+
theme_classic()+
xlab("Principal Component")+
ylab("Variation explained (%)")
```
```{r}
subplot(ggplotly(p1)%>% layout(legend = list(orientation = "h", x = 0.2, y =-0.15)), ggplotly(p2)%>%hide_legend(), ggplotly(pp)%>%hide_legend(), titleX=T,titleY=T,margin=0.035,widths=c(0.375,0.425,0.2),which_layout=1) %>% partial_bundle()
```
### maf = 0.25
```{r}
pca=PCA_list$Prune_unfiltered$maf0.25[[1]]
data_pca=data.frame(INDIV=pca$sample.id,
PC1=pca$eigenvect[,1],
PC2=pca$eigenvect[,2],
PC3=pca$eigenvect[,3],
PC4=pca$eigenvect[,4],
LOCA=c(rep("Algarve",5),
rep("Bay of Biscay",5),
rep("Gulf of Lion",5),
rep("Costa Calida",5)))
color_med_atl=rev(brewer.pal(n=4,name="RdBu"))
p<-ggplot(data=data_pca,aes(x=PC1,y=PC2,label=INDIV))+
theme_minimal()+
theme(panel.grid=element_blank(),
panel.border=element_rect(fill="transparent"),
plot.title=element_text(hjust=0.5))+
geom_hline(yintercept=0,lty=2)+
geom_vline(xintercept=0,lty=2)+
geom_point(size=3,aes(col=LOCA))+
xlab(paste("PCA 1 (",round(pca$varprop[1]*100,2),"% )",sep=""))+
ylab(paste("PCA 2 (",round(pca$varprop[2]*100,2),"% )",sep=""))+
scale_colour_manual(name="Location",
values=c(color_med_atl[2],
color_med_atl[1],
color_med_atl[3],
color_med_atl[4]))
p1<-p
p<-ggplot(data=data_pca,aes(x=PC3,y=PC4,label=INDIV))+
theme_minimal()+
theme(panel.grid=element_blank(),
panel.border=element_rect(fill="transparent"),
plot.title=element_text(hjust=0.5))+
geom_hline(yintercept=0,lty=2)+
geom_vline(xintercept=0,lty=2)+
geom_point(size=3,aes(col=LOCA))+
xlab(paste("PCA 3 (",round(pca$varprop[3]*100,2),"% )",sep=""))+
ylab(paste("PCA 4 (",round(pca$varprop[4]*100,2),"% )",sep=""))+
scale_colour_manual(name="Location",
values=c(color_med_atl[2],
color_med_atl[1],
color_med_atl[3],
color_med_atl[4]))
p2<-p
data_varpop=data.frame(PC=factor(paste("P",seq(1,10),sep=""),levels=paste("P",seq(1,10),sep="")),VAR=pca$varprop[1:10])
pp<-ggplot(data_varpop,aes(x=PC,y=VAR))+
geom_bar(stat='identity',fill="dodgerblue2",alpha=0.25)+
theme_classic()+
xlab("Principal Component")+
ylab("Variation explained (%)")
```
```{r}
subplot(ggplotly(p1)%>% layout(legend = list(orientation = "h", x = 0.2, y =-0.15)), ggplotly(p2)%>%hide_legend(), ggplotly(pp)%>%hide_legend(), titleX=T,titleY=T,margin=0.035,widths=c(0.375,0.425,0.2),which_layout=1) %>% partial_bundle()
```
### maf = 0.30
```{r}
pca=PCA_list$Prune_unfiltered$maf0.3[[1]]
data_pca=data.frame(INDIV=pca$sample.id,
PC1=pca$eigenvect[,1],
PC2=pca$eigenvect[,2],
PC3=pca$eigenvect[,3],
PC4=pca$eigenvect[,4],
LOCA=c(rep("Algarve",5),
rep("Bay of Biscay",5),
rep("Gulf of Lion",5),
rep("Costa Calida",5)))
color_med_atl=rev(brewer.pal(n=4,name="RdBu"))
p<-ggplot(data=data_pca,aes(x=PC1,y=PC2,label=INDIV))+
theme_minimal()+
theme(panel.grid=element_blank(),
panel.border=element_rect(fill="transparent"),
plot.title=element_text(hjust=0.5))+
geom_hline(yintercept=0,lty=2)+
geom_vline(xintercept=0,lty=2)+
geom_point(size=3,aes(col=LOCA))+
xlab(paste("PCA 1 (",round(pca$varprop[1]*100,2),"% )",sep=""))+
ylab(paste("PCA 2 (",round(pca$varprop[2]*100,2),"% )",sep=""))+
scale_colour_manual(name="Location",
values=c(color_med_atl[2],
color_med_atl[1],
color_med_atl[3],
color_med_atl[4]))
p1<-p
p<-ggplot(data=data_pca,aes(x=PC3,y=PC4,label=INDIV))+
theme_minimal()+
theme(panel.grid=element_blank(),
panel.border=element_rect(fill="transparent"),
plot.title=element_text(hjust=0.5))+
geom_hline(yintercept=0,lty=2)+
geom_vline(xintercept=0,lty=2)+
geom_point(size=3,aes(col=LOCA))+
xlab(paste("PCA 3 (",round(pca$varprop[3]*100,2),"% )",sep=""))+
ylab(paste("PCA 4 (",round(pca$varprop[4]*100,2),"% )",sep=""))+
scale_colour_manual(name="Location",
values=c(color_med_atl[2],
color_med_atl[1],
color_med_atl[3],
color_med_atl[4]))
p2<-p
data_varpop=data.frame(PC=factor(paste("P",seq(1,10),sep=""),levels=paste("P",seq(1,10),sep="")),VAR=pca$varprop[1:10])
pp<-ggplot(data_varpop,aes(x=PC,y=VAR))+
geom_bar(stat='identity',fill="dodgerblue2",alpha=0.25)+
theme_classic()+
xlab("Principal Component")+
ylab("Variation explained (%)")
```
```{r}
subplot(ggplotly(p1)%>% layout(legend = list(orientation = "h", x = 0.2, y =-0.15)), ggplotly(p2)%>%hide_legend(), ggplotly(pp)%>%hide_legend(), titleX=T,titleY=T,margin=0.035,widths=c(0.375,0.425,0.2),which_layout=1) %>% partial_bundle()
```
### maf = 0.35
```{r}
pca=PCA_list$Prune_unfiltered$maf0.35[[1]]
data_pca=data.frame(INDIV=pca$sample.id,
PC1=pca$eigenvect[,1],
PC2=pca$eigenvect[,2],
PC3=pca$eigenvect[,3],
PC4=pca$eigenvect[,4],
LOCA=c(rep("Algarve",5),
rep("Bay of Biscay",5),
rep("Gulf of Lion",5),
rep("Costa Calida",5)))
color_med_atl=rev(brewer.pal(n=4,name="RdBu"))
p<-ggplot(data=data_pca,aes(x=PC1,y=PC2,label=INDIV))+
theme_minimal()+
theme(panel.grid=element_blank(),
panel.border=element_rect(fill="transparent"),
plot.title=element_text(hjust=0.5))+
geom_hline(yintercept=0,lty=2)+
geom_vline(xintercept=0,lty=2)+
geom_point(size=3,aes(col=LOCA))+
xlab(paste("PCA 1 (",round(pca$varprop[1]*100,2),"% )",sep=""))+
ylab(paste("PCA 2 (",round(pca$varprop[2]*100,2),"% )",sep=""))+
scale_colour_manual(name="Location",
values=c(color_med_atl[2],
color_med_atl[1],
color_med_atl[3],
color_med_atl[4]))
p1<-p
p<-ggplot(data=data_pca,aes(x=PC3,y=PC4,label=INDIV))+
theme_minimal()+
theme(panel.grid=element_blank(),
panel.border=element_rect(fill="transparent"),
plot.title=element_text(hjust=0.5))+
geom_hline(yintercept=0,lty=2)+
geom_vline(xintercept=0,lty=2)+
geom_point(size=3,aes(col=LOCA))+
xlab(paste("PCA 3 (",round(pca$varprop[3]*100,2),"% )",sep=""))+
ylab(paste("PCA 4 (",round(pca$varprop[4]*100,2),"% )",sep=""))+
scale_colour_manual(name="Location",
values=c(color_med_atl[2],
color_med_atl[1],
color_med_atl[3],
color_med_atl[4]))
p2<-p
data_varpop=data.frame(PC=factor(paste("P",seq(1,10),sep=""),levels=paste("P",seq(1,10),sep="")),VAR=pca$varprop[1:10])
pp<-ggplot(data_varpop,aes(x=PC,y=VAR))+
geom_bar(stat='identity',fill="dodgerblue2",alpha=0.25)+
theme_classic()+
xlab("Principal Component")+
ylab("Variation explained (%)")
```
```{r}
subplot(ggplotly(p1)%>% layout(legend = list(orientation = "h", x = 0.2, y =-0.15)), ggplotly(p2)%>%hide_legend(), ggplotly(pp)%>%hide_legend(), titleX=T,titleY=T,margin=0.035,widths=c(0.375,0.425,0.2),which_layout=1) %>% partial_bundle()
```
### maf = 0.40
```{r}
pca=PCA_list$Prune_unfiltered$maf0.4[[1]]
data_pca=data.frame(INDIV=pca$sample.id,
PC1=pca$eigenvect[,1],
PC2=pca$eigenvect[,2],
PC3=pca$eigenvect[,3],
PC4=pca$eigenvect[,4],
LOCA=c(rep("Algarve",5),
rep("Bay of Biscay",5),
rep("Gulf of Lion",5),
rep("Costa Calida",5)))
color_med_atl=rev(brewer.pal(n=4,name="RdBu"))
p<-ggplot(data=data_pca,aes(x=PC1,y=PC2,label=INDIV))+
theme_minimal()+
theme(panel.grid=element_blank(),
panel.border=element_rect(fill="transparent"),
plot.title=element_text(hjust=0.5))+
geom_hline(yintercept=0,lty=2)+
geom_vline(xintercept=0,lty=2)+
geom_point(size=3,aes(col=LOCA))+
xlab(paste("PCA 1 (",round(pca$varprop[1]*100,2),"% )",sep=""))+
ylab(paste("PCA 2 (",round(pca$varprop[2]*100,2),"% )",sep=""))+
scale_colour_manual(name="Location",
values=c(color_med_atl[2],
color_med_atl[1],
color_med_atl[3],
color_med_atl[4]))
p1<-p
p<-ggplot(data=data_pca,aes(x=PC3,y=PC4,label=INDIV))+
theme_minimal()+
theme(panel.grid=element_blank(),
panel.border=element_rect(fill="transparent"),
plot.title=element_text(hjust=0.5))+
geom_hline(yintercept=0,lty=2)+
geom_vline(xintercept=0,lty=2)+
geom_point(size=3,aes(col=LOCA))+
xlab(paste("PCA 3 (",round(pca$varprop[3]*100,2),"% )",sep=""))+
ylab(paste("PCA 4 (",round(pca$varprop[4]*100,2),"% )",sep=""))+
scale_colour_manual(name="Location",
values=c(color_med_atl[2],
color_med_atl[1],
color_med_atl[3],
color_med_atl[4]))
p2<-p
data_varpop=data.frame(PC=factor(paste("P",seq(1,10),sep=""),levels=paste("P",seq(1,10),sep="")),VAR=pca$varprop[1:10])
pp<-ggplot(data_varpop,aes(x=PC,y=VAR))+
geom_bar(stat='identity',fill="dodgerblue2",alpha=0.25)+
theme_classic()+
xlab("Principal Component")+
ylab("Variation explained (%)")
```
```{r}
subplot(ggplotly(p1)%>% layout(legend = list(orientation = "h", x = 0.2, y =-0.15)), ggplotly(p2)%>%hide_legend(), ggplotly(pp)%>%hide_legend(), titleX=T,titleY=T,margin=0.035,widths=c(0.375,0.425,0.2),which_layout=1) %>% partial_bundle()
```
### maf = 0.45
```{r}
pca=PCA_list$Prune_unfiltered$maf0.45[[1]]
data_pca=data.frame(INDIV=pca$sample.id,
PC1=pca$eigenvect[,1],
PC2=pca$eigenvect[,2],
PC3=pca$eigenvect[,3],
PC4=pca$eigenvect[,4],
LOCA=c(rep("Algarve",5),
rep("Bay of Biscay",5),
rep("Gulf of Lion",5),
rep("Costa Calida",5)))
color_med_atl=rev(brewer.pal(n=4,name="RdBu"))
p<-ggplot(data=data_pca,aes(x=PC1,y=PC2,label=INDIV))+
theme_minimal()+
theme(panel.grid=element_blank(),
panel.border=element_rect(fill="transparent"),
plot.title=element_text(hjust=0.5))+
geom_hline(yintercept=0,lty=2)+
geom_vline(xintercept=0,lty=2)+
geom_point(size=3,aes(col=LOCA))+
xlab(paste("PCA 1 (",round(pca$varprop[1]*100,2),"% )",sep=""))+
ylab(paste("PCA 2 (",round(pca$varprop[2]*100,2),"% )",sep=""))+
scale_colour_manual(name="Location",
values=c(color_med_atl[2],
color_med_atl[1],
color_med_atl[3],
color_med_atl[4]))
p1<-p
p<-ggplot(data=data_pca,aes(x=PC3,y=PC4,label=INDIV))+
theme_minimal()+
theme(panel.grid=element_blank(),
panel.border=element_rect(fill="transparent"),
plot.title=element_text(hjust=0.5))+
geom_hline(yintercept=0,lty=2)+
geom_vline(xintercept=0,lty=2)+
geom_point(size=3,aes(col=LOCA))+
xlab(paste("PCA 3 (",round(pca$varprop[3]*100,2),"% )",sep=""))+
ylab(paste("PCA 4 (",round(pca$varprop[4]*100,2),"% )",sep=""))+
scale_colour_manual(name="Location",
values=c(color_med_atl[2],
color_med_atl[1],
color_med_atl[3],
color_med_atl[4]))
p2<-p
data_varpop=data.frame(PC=factor(paste("P",seq(1,10),sep=""),levels=paste("P",seq(1,10),sep="")),VAR=pca$varprop[1:10])
pp<-ggplot(data_varpop,aes(x=PC,y=VAR))+
geom_bar(stat='identity',fill="dodgerblue2",alpha=0.25)+
theme_classic()+
xlab("Principal Component")+
ylab("Variation explained (%)")
```
```{r}
subplot(ggplotly(p1)%>% layout(legend = list(orientation = "h", x = 0.2, y =-0.15)), ggplotly(p2)%>%hide_legend(), ggplotly(pp)%>%hide_legend(), titleX=T,titleY=T,margin=0.035,widths=c(0.375,0.425,0.2),which_layout=1) %>% partial_bundle()
```
### maf = 0.50
```{r}
pca=PCA_list$Prune_unfiltered$maf0.5[[1]]
data_pca=data.frame(INDIV=pca$sample.id,
PC1=pca$eigenvect[,1],
PC2=pca$eigenvect[,2],
PC3=pca$eigenvect[,3],
PC4=pca$eigenvect[,4],
LOCA=c(rep("Algarve",5),
rep("Bay of Biscay",5),
rep("Gulf of Lion",5),
rep("Costa Calida",5)))
color_med_atl=rev(brewer.pal(n=4,name="RdBu"))
p<-ggplot(data=data_pca,aes(x=PC1,y=PC2,label=INDIV))+
theme_minimal()+
theme(panel.grid=element_blank(),
panel.border=element_rect(fill="transparent"),
plot.title=element_text(hjust=0.5))+
geom_hline(yintercept=0,lty=2)+
geom_vline(xintercept=0,lty=2)+
geom_point(size=3,aes(col=LOCA))+
xlab(paste("PCA 1 (",round(pca$varprop[1]*100,2),"% )",sep=""))+
ylab(paste("PCA 2 (",round(pca$varprop[2]*100,2),"% )",sep=""))+
scale_colour_manual(name="Location",
values=c(color_med_atl[2],
color_med_atl[1],
color_med_atl[3],
color_med_atl[4]))
p1<-p
p<-ggplot(data=data_pca,aes(x=PC3,y=PC4,label=INDIV))+
theme_minimal()+
theme(panel.grid=element_blank(),
panel.border=element_rect(fill="transparent"),
plot.title=element_text(hjust=0.5))+
geom_hline(yintercept=0,lty=2)+
geom_vline(xintercept=0,lty=2)+
geom_point(size=3,aes(col=LOCA))+
xlab(paste("PCA 3 (",round(pca$varprop[3]*100,2),"% )",sep=""))+
ylab(paste("PCA 4 (",round(pca$varprop[4]*100,2),"% )",sep=""))+
scale_colour_manual(name="Location",
values=c(color_med_atl[2],
color_med_atl[1],
color_med_atl[3],
color_med_atl[4]))
p2<-p
data_varpop=data.frame(PC=factor(paste("P",seq(1,10),sep=""),levels=paste("P",seq(1,10),sep="")),VAR=pca$varprop[1:10])
pp<-ggplot(data_varpop,aes(x=PC,y=VAR))+
geom_bar(stat='identity',fill="dodgerblue2",alpha=0.25)+
theme_classic()+
xlab("Principal Component")+
ylab("Variation explained (%)")
```
```{r}
subplot(ggplotly(p1)%>% layout(legend = list(orientation = "h", x = 0.2, y =-0.15)), ggplotly(p2)%>%hide_legend(), ggplotly(pp)%>%hide_legend(), titleX=T,titleY=T,margin=0.035,widths=c(0.375,0.425,0.2),which_layout=1) %>% partial_bundle()
```
Syngnathus typhle {data-navmenu="Species"}
=======================================================================
```{r, include = FALSE}
load(file = paste(path,"/output/pca/Styph_PCA_list.Rdata",sep=""))
```
Row {.tabset data-height=100}
-----------------------
<center>
<font size="6">**Syngnathus typhle**</font>
</center>
Row {.tabset data-height=50}
-----------------------
<center>
<font size="6">**All filtered SNPS**</font>
</center>
Row {.tabset data-height=600}
-----------------------
### maf = 0
```{r}
pca=PCA_list$All_filtered$maf0[[1]]
data_pca=data.frame(INDIV=pca$sample.id,
PC1=pca$eigenvect[,1],
PC2=pca$eigenvect[,2],
PC3=pca$eigenvect[,3],
PC4=pca$eigenvect[,4],
LOCA=c(rep("Algarve",5),
rep("Bay of Biscay",5),
rep("Gulf of Lion",5),
rep("Costa Calida",5)))
color_med_atl=rev(brewer.pal(n=4,name="RdBu"))
p<-ggplot(data=data_pca,aes(x=PC1,y=PC2,label=INDIV))+
theme_minimal()+
theme(panel.grid=element_blank(),
panel.border=element_rect(fill="transparent"),
plot.title=element_text(hjust=0.5))+
geom_hline(yintercept=0,lty=2)+
geom_vline(xintercept=0,lty=2)+
geom_point(size=3,aes(col=LOCA))+
xlab(paste("PCA 1 (",round(pca$varprop[1]*100,2),"% )",sep=""))+
ylab(paste("PCA 2 (",round(pca$varprop[2]*100,2),"% )",sep=""))+
scale_colour_manual(name="Location",
values=c(color_med_atl[2],
color_med_atl[1],
color_med_atl[3],
color_med_atl[4]))
p1<-p
p<-ggplot(data=data_pca,aes(x=PC3,y=PC4,label=INDIV))+
theme_minimal()+
theme(panel.grid=element_blank(),
panel.border=element_rect(fill="transparent"),
plot.title=element_text(hjust=0.5))+
geom_hline(yintercept=0,lty=2)+
geom_vline(xintercept=0,lty=2)+
geom_point(size=3,aes(col=LOCA))+
xlab(paste("PCA 3 (",round(pca$varprop[3]*100,2),"% )",sep=""))+
ylab(paste("PCA 4 (",round(pca$varprop[4]*100,2),"% )",sep=""))+
scale_colour_manual(name="Location",
values=c(color_med_atl[2],
color_med_atl[1],
color_med_atl[3],
color_med_atl[4]))
p2<-p
data_varpop=data.frame(PC=factor(paste("P",seq(1,10),sep=""),levels=paste("P",seq(1,10),sep="")),VAR=pca$varprop[1:10])
pp<-ggplot(data_varpop,aes(x=PC,y=VAR))+
geom_bar(stat='identity',fill="dodgerblue2",alpha=0.25)+
theme_classic()+
xlab("Principal Component")+
ylab("Variation explained (%)")
```
```{r}
subplot(ggplotly(p1)%>% layout(legend = list(orientation = "h", x = 0.2, y =-0.15)), ggplotly(p2)%>%hide_legend(), ggplotly(pp)%>%hide_legend(), titleX=T,titleY=T,margin=0.035,widths=c(0.375,0.425,0.2),which_layout=1) %>% partial_bundle()
```
### maf = 0.05
```{r}
pca=PCA_list$All_filtered$maf0.05[[1]]
data_pca=data.frame(INDIV=pca$sample.id,
PC1=pca$eigenvect[,1],
PC2=pca$eigenvect[,2],
PC3=pca$eigenvect[,3],
PC4=pca$eigenvect[,4],
LOCA=c(rep("Algarve",5),
rep("Bay of Biscay",5),
rep("Gulf of Lion",5),
rep("Costa Calida",5)))
color_med_atl=rev(brewer.pal(n=4,name="RdBu"))
p<-ggplot(data=data_pca,aes(x=PC1,y=PC2,label=INDIV))+
theme_minimal()+
theme(panel.grid=element_blank(),
panel.border=element_rect(fill="transparent"),
plot.title=element_text(hjust=0.5))+
geom_hline(yintercept=0,lty=2)+
geom_vline(xintercept=0,lty=2)+
geom_point(size=3,aes(col=LOCA))+
xlab(paste("PCA 1 (",round(pca$varprop[1]*100,2),"% )",sep=""))+
ylab(paste("PCA 2 (",round(pca$varprop[2]*100,2),"% )",sep=""))+
scale_colour_manual(name="Location",
values=c(color_med_atl[2],
color_med_atl[1],
color_med_atl[3],
color_med_atl[4]))
p1<-p
p<-ggplot(data=data_pca,aes(x=PC3,y=PC4,label=INDIV))+
theme_minimal()+
theme(panel.grid=element_blank(),
panel.border=element_rect(fill="transparent"),
plot.title=element_text(hjust=0.5))+
geom_hline(yintercept=0,lty=2)+
geom_vline(xintercept=0,lty=2)+
geom_point(size=3,aes(col=LOCA))+
xlab(paste("PCA 3 (",round(pca$varprop[3]*100,2),"% )",sep=""))+
ylab(paste("PCA 4 (",round(pca$varprop[4]*100,2),"% )",sep=""))+
scale_colour_manual(name="Location",
values=c(color_med_atl[2],
color_med_atl[1],
color_med_atl[3],
color_med_atl[4]))
p2<-p
data_varpop=data.frame(PC=factor(paste("P",seq(1,10),sep=""),levels=paste("P",seq(1,10),sep="")),VAR=pca$varprop[1:10])
pp<-ggplot(data_varpop,aes(x=PC,y=VAR))+
geom_bar(stat='identity',fill="dodgerblue2",alpha=0.25)+
theme_classic()+
xlab("Principal Component")+
ylab("Variation explained (%)")
```
```{r}
subplot(ggplotly(p1)%>% layout(legend = list(orientation = "h", x = 0.2, y =-0.15)), ggplotly(p2)%>%hide_legend(), ggplotly(pp)%>%hide_legend(), titleX=T,titleY=T,margin=0.035,widths=c(0.375,0.425,0.2),which_layout=1) %>% partial_bundle()
```
### maf = 0.1
```{r}
pca=PCA_list$All_filtered$maf0.1[[1]]
data_pca=data.frame(INDIV=pca$sample.id,
PC1=pca$eigenvect[,1],
PC2=pca$eigenvect[,2],
PC3=pca$eigenvect[,3],
PC4=pca$eigenvect[,4],
LOCA=c(rep("Algarve",5),
rep("Bay of Biscay",5),
rep("Gulf of Lion",5),
rep("Costa Calida",5)))
color_med_atl=rev(brewer.pal(n=4,name="RdBu"))
p<-ggplot(data=data_pca,aes(x=PC1,y=PC2,label=INDIV))+
theme_minimal()+
theme(panel.grid=element_blank(),
panel.border=element_rect(fill="transparent"),
plot.title=element_text(hjust=0.5))+
geom_hline(yintercept=0,lty=2)+
geom_vline(xintercept=0,lty=2)+
geom_point(size=3,aes(col=LOCA))+
xlab(paste("PCA 1 (",round(pca$varprop[1]*100,2),"% )",sep=""))+
ylab(paste("PCA 2 (",round(pca$varprop[2]*100,2),"% )",sep=""))+
scale_colour_manual(name="Location",
values=c(color_med_atl[2],
color_med_atl[1],
color_med_atl[3],
color_med_atl[4]))
p1<-p
p<-ggplot(data=data_pca,aes(x=PC3,y=PC4,label=INDIV))+
theme_minimal()+
theme(panel.grid=element_blank(),
panel.border=element_rect(fill="transparent"),
plot.title=element_text(hjust=0.5))+
geom_hline(yintercept=0,lty=2)+
geom_vline(xintercept=0,lty=2)+
geom_point(size=3,aes(col=LOCA))+
xlab(paste("PCA 3 (",round(pca$varprop[3]*100,2),"% )",sep=""))+
ylab(paste("PCA 4 (",round(pca$varprop[4]*100,2),"% )",sep=""))+
scale_colour_manual(name="Location",
values=c(color_med_atl[2],
color_med_atl[1],
color_med_atl[3],
color_med_atl[4]))
p2<-p
data_varpop=data.frame(PC=factor(paste("P",seq(1,10),sep=""),levels=paste("P",seq(1,10),sep="")),VAR=pca$varprop[1:10])
pp<-ggplot(data_varpop,aes(x=PC,y=VAR))+
geom_bar(stat='identity',fill="dodgerblue2",alpha=0.25)+
theme_classic()+
xlab("Principal Component")+
ylab("Variation explained (%)")
```
```{r}
subplot(ggplotly(p1)%>% layout(legend = list(orientation = "h", x = 0.2, y =-0.15)), ggplotly(p2)%>%hide_legend(), ggplotly(pp)%>%hide_legend(), titleX=T,titleY=T,margin=0.035,widths=c(0.375,0.425,0.2),which_layout=1) %>% partial_bundle()
```
### maf = 0.15
```{r}
pca=PCA_list$All_filtered$maf0.15[[1]]
data_pca=data.frame(INDIV=pca$sample.id,
PC1=pca$eigenvect[,1],
PC2=pca$eigenvect[,2],
PC3=pca$eigenvect[,3],
PC4=pca$eigenvect[,4],
LOCA=c(rep("Algarve",5),
rep("Bay of Biscay",5),
rep("Gulf of Lion",5),
rep("Costa Calida",5)))
color_med_atl=rev(brewer.pal(n=4,name="RdBu"))
p<-ggplot(data=data_pca,aes(x=PC1,y=PC2,label=INDIV))+
theme_minimal()+
theme(panel.grid=element_blank(),
panel.border=element_rect(fill="transparent"),
plot.title=element_text(hjust=0.5))+
geom_hline(yintercept=0,lty=2)+
geom_vline(xintercept=0,lty=2)+
geom_point(size=3,aes(col=LOCA))+
xlab(paste("PCA 1 (",round(pca$varprop[1]*100,2),"% )",sep=""))+
ylab(paste("PCA 2 (",round(pca$varprop[2]*100,2),"% )",sep=""))+
scale_colour_manual(name="Location",
values=c(color_med_atl[2],
color_med_atl[1],
color_med_atl[3],
color_med_atl[4]))
p1<-p
p<-ggplot(data=data_pca,aes(x=PC3,y=PC4,label=INDIV))+
theme_minimal()+
theme(panel.grid=element_blank(),
panel.border=element_rect(fill="transparent"),
plot.title=element_text(hjust=0.5))+
geom_hline(yintercept=0,lty=2)+
geom_vline(xintercept=0,lty=2)+
geom_point(size=3,aes(col=LOCA))+
xlab(paste("PCA 3 (",round(pca$varprop[3]*100,2),"% )",sep=""))+
ylab(paste("PCA 4 (",round(pca$varprop[4]*100,2),"% )",sep=""))+
scale_colour_manual(name="Location",
values=c(color_med_atl[2],
color_med_atl[1],
color_med_atl[3],
color_med_atl[4]))
p2<-p
data_varpop=data.frame(PC=factor(paste("P",seq(1,10),sep=""),levels=paste("P",seq(1,10),sep="")),VAR=pca$varprop[1:10])
pp<-ggplot(data_varpop,aes(x=PC,y=VAR))+
geom_bar(stat='identity',fill="dodgerblue2",alpha=0.25)+
theme_classic()+
xlab("Principal Component")+
ylab("Variation explained (%)")
```
```{r}
subplot(ggplotly(p1)%>% layout(legend = list(orientation = "h", x = 0.2, y =-0.15)), ggplotly(p2)%>%hide_legend(), ggplotly(pp)%>%hide_legend(), titleX=T,titleY=T,margin=0.035,widths=c(0.375,0.425,0.2),which_layout=1) %>% partial_bundle()
```
### maf = 0.20
```{r}
pca=PCA_list$All_filtered$maf0.2[[1]]
data_pca=data.frame(INDIV=pca$sample.id,
PC1=pca$eigenvect[,1],
PC2=pca$eigenvect[,2],
PC3=pca$eigenvect[,3],
PC4=pca$eigenvect[,4],
LOCA=c(rep("Algarve",5),
rep("Bay of Biscay",5),
rep("Gulf of Lion",5),
rep("Costa Calida",5)))
color_med_atl=rev(brewer.pal(n=4,name="RdBu"))
p<-ggplot(data=data_pca,aes(x=PC1,y=PC2,label=INDIV))+
theme_minimal()+
theme(panel.grid=element_blank(),
panel.border=element_rect(fill="transparent"),
plot.title=element_text(hjust=0.5))+
geom_hline(yintercept=0,lty=2)+
geom_vline(xintercept=0,lty=2)+
geom_point(size=3,aes(col=LOCA))+
xlab(paste("PCA 1 (",round(pca$varprop[1]*100,2),"% )",sep=""))+
ylab(paste("PCA 2 (",round(pca$varprop[2]*100,2),"% )",sep=""))+
scale_colour_manual(name="Location",
values=c(color_med_atl[2],
color_med_atl[1],
color_med_atl[3],
color_med_atl[4]))
p1<-p
p<-ggplot(data=data_pca,aes(x=PC3,y=PC4,label=INDIV))+
theme_minimal()+
theme(panel.grid=element_blank(),
panel.border=element_rect(fill="transparent"),
plot.title=element_text(hjust=0.5))+
geom_hline(yintercept=0,lty=2)+
geom_vline(xintercept=0,lty=2)+
geom_point(size=3,aes(col=LOCA))+
xlab(paste("PCA 3 (",round(pca$varprop[3]*100,2),"% )",sep=""))+
ylab(paste("PCA 4 (",round(pca$varprop[4]*100,2),"% )",sep=""))+
scale_colour_manual(name="Location",
values=c(color_med_atl[2],
color_med_atl[1],
color_med_atl[3],
color_med_atl[4]))
p2<-p
data_varpop=data.frame(PC=factor(paste("P",seq(1,10),sep=""),levels=paste("P",seq(1,10),sep="")),VAR=pca$varprop[1:10])
pp<-ggplot(data_varpop,aes(x=PC,y=VAR))+
geom_bar(stat='identity',fill="dodgerblue2",alpha=0.25)+
theme_classic()+
xlab("Principal Component")+
ylab("Variation explained (%)")
```
```{r}
subplot(ggplotly(p1)%>% layout(legend = list(orientation = "h", x = 0.2, y =-0.15)), ggplotly(p2)%>%hide_legend(), ggplotly(pp)%>%hide_legend(), titleX=T,titleY=T,margin=0.035,widths=c(0.375,0.425,0.2),which_layout=1) %>% partial_bundle()
```
### maf = 0.25
```{r}
pca=PCA_list$All_filtered$maf0.25[[1]]
data_pca=data.frame(INDIV=pca$sample.id,
PC1=pca$eigenvect[,1],
PC2=pca$eigenvect[,2],
PC3=pca$eigenvect[,3],
PC4=pca$eigenvect[,4],
LOCA=c(rep("Algarve",5),
rep("Bay of Biscay",5),
rep("Gulf of Lion",5),
rep("Costa Calida",5)))
color_med_atl=rev(brewer.pal(n=4,name="RdBu"))
p<-ggplot(data=data_pca,aes(x=PC1,y=PC2,label=INDIV))+
theme_minimal()+
theme(panel.grid=element_blank(),
panel.border=element_rect(fill="transparent"),
plot.title=element_text(hjust=0.5))+
geom_hline(yintercept=0,lty=2)+
geom_vline(xintercept=0,lty=2)+
geom_point(size=3,aes(col=LOCA))+
xlab(paste("PCA 1 (",round(pca$varprop[1]*100,2),"% )",sep=""))+
ylab(paste("PCA 2 (",round(pca$varprop[2]*100,2),"% )",sep=""))+
scale_colour_manual(name="Location",
values=c(color_med_atl[2],
color_med_atl[1],
color_med_atl[3],
color_med_atl[4]))
p1<-p
p<-ggplot(data=data_pca,aes(x=PC3,y=PC4,label=INDIV))+
theme_minimal()+
theme(panel.grid=element_blank(),
panel.border=element_rect(fill="transparent"),
plot.title=element_text(hjust=0.5))+
geom_hline(yintercept=0,lty=2)+
geom_vline(xintercept=0,lty=2)+
geom_point(size=3,aes(col=LOCA))+
xlab(paste("PCA 3 (",round(pca$varprop[3]*100,2),"% )",sep=""))+
ylab(paste("PCA 4 (",round(pca$varprop[4]*100,2),"% )",sep=""))+
scale_colour_manual(name="Location",
values=c(color_med_atl[2],
color_med_atl[1],
color_med_atl[3],
color_med_atl[4]))
p2<-p
data_varpop=data.frame(PC=factor(paste("P",seq(1,10),sep=""),levels=paste("P",seq(1,10),sep="")),VAR=pca$varprop[1:10])
pp<-ggplot(data_varpop,aes(x=PC,y=VAR))+
geom_bar(stat='identity',fill="dodgerblue2",alpha=0.25)+
theme_classic()+
xlab("Principal Component")+
ylab("Variation explained (%)")
```
```{r}
subplot(ggplotly(p1)%>% layout(legend = list(orientation = "h", x = 0.2, y =-0.15)), ggplotly(p2)%>%hide_legend(), ggplotly(pp)%>%hide_legend(), titleX=T,titleY=T,margin=0.035,widths=c(0.375,0.425,0.2),which_layout=1) %>% partial_bundle()
```
### maf = 0.30
```{r}
pca=PCA_list$All_filtered$maf0.3[[1]]
data_pca=data.frame(INDIV=pca$sample.id,
PC1=pca$eigenvect[,1],
PC2=pca$eigenvect[,2],
PC3=pca$eigenvect[,3],
PC4=pca$eigenvect[,4],
LOCA=c(rep("Algarve",5),
rep("Bay of Biscay",5),
rep("Gulf of Lion",5),
rep("Costa Calida",5)))
color_med_atl=rev(brewer.pal(n=4,name="RdBu"))
p<-ggplot(data=data_pca,aes(x=PC1,y=PC2,label=INDIV))+
theme_minimal()+
theme(panel.grid=element_blank(),
panel.border=element_rect(fill="transparent"),
plot.title=element_text(hjust=0.5))+
geom_hline(yintercept=0,lty=2)+
geom_vline(xintercept=0,lty=2)+
geom_point(size=3,aes(col=LOCA))+
xlab(paste("PCA 1 (",round(pca$varprop[1]*100,2),"% )",sep=""))+
ylab(paste("PCA 2 (",round(pca$varprop[2]*100,2),"% )",sep=""))+
scale_colour_manual(name="Location",
values=c(color_med_atl[2],
color_med_atl[1],
color_med_atl[3],
color_med_atl[4]))
p1<-p
p<-ggplot(data=data_pca,aes(x=PC3,y=PC4,label=INDIV))+
theme_minimal()+
theme(panel.grid=element_blank(),
panel.border=element_rect(fill="transparent"),
plot.title=element_text(hjust=0.5))+
geom_hline(yintercept=0,lty=2)+
geom_vline(xintercept=0,lty=2)+
geom_point(size=3,aes(col=LOCA))+
xlab(paste("PCA 3 (",round(pca$varprop[3]*100,2),"% )",sep=""))+
ylab(paste("PCA 4 (",round(pca$varprop[4]*100,2),"% )",sep=""))+
scale_colour_manual(name="Location",
values=c(color_med_atl[2],
color_med_atl[1],
color_med_atl[3],
color_med_atl[4]))
p2<-p
data_varpop=data.frame(PC=factor(paste("P",seq(1,10),sep=""),levels=paste("P",seq(1,10),sep="")),VAR=pca$varprop[1:10])
pp<-ggplot(data_varpop,aes(x=PC,y=VAR))+
geom_bar(stat='identity',fill="dodgerblue2",alpha=0.25)+
theme_classic()+
xlab("Principal Component")+
ylab("Variation explained (%)")
```
```{r}
subplot(ggplotly(p1)%>% layout(legend = list(orientation = "h", x = 0.2, y =-0.15)), ggplotly(p2)%>%hide_legend(), ggplotly(pp)%>%hide_legend(), titleX=T,titleY=T,margin=0.035,widths=c(0.375,0.425,0.2),which_layout=1) %>% partial_bundle()
```
### maf = 0.35
```{r}
pca=PCA_list$All_filtered$maf0.35[[1]]
data_pca=data.frame(INDIV=pca$sample.id,
PC1=pca$eigenvect[,1],
PC2=pca$eigenvect[,2],
PC3=pca$eigenvect[,3],
PC4=pca$eigenvect[,4],
LOCA=c(rep("Algarve",5),
rep("Bay of Biscay",5),
rep("Gulf of Lion",5),
rep("Costa Calida",5)))
color_med_atl=rev(brewer.pal(n=4,name="RdBu"))
p<-ggplot(data=data_pca,aes(x=PC1,y=PC2,label=INDIV))+
theme_minimal()+
theme(panel.grid=element_blank(),
panel.border=element_rect(fill="transparent"),
plot.title=element_text(hjust=0.5))+
geom_hline(yintercept=0,lty=2)+
geom_vline(xintercept=0,lty=2)+
geom_point(size=3,aes(col=LOCA))+
xlab(paste("PCA 1 (",round(pca$varprop[1]*100,2),"% )",sep=""))+
ylab(paste("PCA 2 (",round(pca$varprop[2]*100,2),"% )",sep=""))+
scale_colour_manual(name="Location",
values=c(color_med_atl[2],
color_med_atl[1],
color_med_atl[3],
color_med_atl[4]))
p1<-p
p<-ggplot(data=data_pca,aes(x=PC3,y=PC4,label=INDIV))+
theme_minimal()+
theme(panel.grid=element_blank(),
panel.border=element_rect(fill="transparent"),
plot.title=element_text(hjust=0.5))+
geom_hline(yintercept=0,lty=2)+
geom_vline(xintercept=0,lty=2)+
geom_point(size=3,aes(col=LOCA))+
xlab(paste("PCA 3 (",round(pca$varprop[3]*100,2),"% )",sep=""))+
ylab(paste("PCA 4 (",round(pca$varprop[4]*100,2),"% )",sep=""))+
scale_colour_manual(name="Location",
values=c(color_med_atl[2],
color_med_atl[1],
color_med_atl[3],
color_med_atl[4]))
p2<-p
data_varpop=data.frame(PC=factor(paste("P",seq(1,10),sep=""),levels=paste("P",seq(1,10),sep="")),VAR=pca$varprop[1:10])
pp<-ggplot(data_varpop,aes(x=PC,y=VAR))+
geom_bar(stat='identity',fill="dodgerblue2",alpha=0.25)+
theme_classic()+
xlab("Principal Component")+
ylab("Variation explained (%)")
```
```{r}
subplot(ggplotly(p1)%>% layout(legend = list(orientation = "h", x = 0.2, y =-0.15)), ggplotly(p2)%>%hide_legend(), ggplotly(pp)%>%hide_legend(), titleX=T,titleY=T,margin=0.035,widths=c(0.375,0.425,0.2),which_layout=1) %>% partial_bundle()
```
### maf = 0.40
```{r}
pca=PCA_list$All_filtered$maf0.4[[1]]
data_pca=data.frame(INDIV=pca$sample.id,
PC1=pca$eigenvect[,1],
PC2=pca$eigenvect[,2],
PC3=pca$eigenvect[,3],
PC4=pca$eigenvect[,4],
LOCA=c(rep("Algarve",5),
rep("Bay of Biscay",5),
rep("Gulf of Lion",5),
rep("Costa Calida",5)))
color_med_atl=rev(brewer.pal(n=4,name="RdBu"))
p<-ggplot(data=data_pca,aes(x=PC1,y=PC2,label=INDIV))+
theme_minimal()+
theme(panel.grid=element_blank(),
panel.border=element_rect(fill="transparent"),
plot.title=element_text(hjust=0.5))+
geom_hline(yintercept=0,lty=2)+
geom_vline(xintercept=0,lty=2)+
geom_point(size=3,aes(col=LOCA))+
xlab(paste("PCA 1 (",round(pca$varprop[1]*100,2),"% )",sep=""))+
ylab(paste("PCA 2 (",round(pca$varprop[2]*100,2),"% )",sep=""))+
scale_colour_manual(name="Location",
values=c(color_med_atl[2],
color_med_atl[1],
color_med_atl[3],
color_med_atl[4]))
p1<-p
p<-ggplot(data=data_pca,aes(x=PC3,y=PC4,label=INDIV))+
theme_minimal()+
theme(panel.grid=element_blank(),
panel.border=element_rect(fill="transparent"),
plot.title=element_text(hjust=0.5))+
geom_hline(yintercept=0,lty=2)+
geom_vline(xintercept=0,lty=2)+
geom_point(size=3,aes(col=LOCA))+
xlab(paste("PCA 3 (",round(pca$varprop[3]*100,2),"% )",sep=""))+
ylab(paste("PCA 4 (",round(pca$varprop[4]*100,2),"% )",sep=""))+
scale_colour_manual(name="Location",
values=c(color_med_atl[2],
color_med_atl[1],
color_med_atl[3],
color_med_atl[4]))
p2<-p
data_varpop=data.frame(PC=factor(paste("P",seq(1,10),sep=""),levels=paste("P",seq(1,10),sep="")),VAR=pca$varprop[1:10])
pp<-ggplot(data_varpop,aes(x=PC,y=VAR))+
geom_bar(stat='identity',fill="dodgerblue2",alpha=0.25)+
theme_classic()+
xlab("Principal Component")+
ylab("Variation explained (%)")
```
```{r}
subplot(ggplotly(p1)%>% layout(legend = list(orientation = "h", x = 0.2, y =-0.15)), ggplotly(p2)%>%hide_legend(), ggplotly(pp)%>%hide_legend(), titleX=T,titleY=T,margin=0.035,widths=c(0.375,0.425,0.2),which_layout=1) %>% partial_bundle()
```
### maf = 0.45
```{r}
pca=PCA_list$All_filtered$maf0.45[[1]]
data_pca=data.frame(INDIV=pca$sample.id,
PC1=pca$eigenvect[,1],
PC2=pca$eigenvect[,2],
PC3=pca$eigenvect[,3],
PC4=pca$eigenvect[,4],
LOCA=c(rep("Algarve",5),
rep("Bay of Biscay",5),
rep("Gulf of Lion",5),
rep("Costa Calida",5)))
color_med_atl=rev(brewer.pal(n=4,name="RdBu"))
p<-ggplot(data=data_pca,aes(x=PC1,y=PC2,label=INDIV))+
theme_minimal()+
theme(panel.grid=element_blank(),
panel.border=element_rect(fill="transparent"),
plot.title=element_text(hjust=0.5))+
geom_hline(yintercept=0,lty=2)+
geom_vline(xintercept=0,lty=2)+
geom_point(size=3,aes(col=LOCA))+
xlab(paste("PCA 1 (",round(pca$varprop[1]*100,2),"% )",sep=""))+
ylab(paste("PCA 2 (",round(pca$varprop[2]*100,2),"% )",sep=""))+
scale_colour_manual(name="Location",
values=c(color_med_atl[2],
color_med_atl[1],
color_med_atl[3],
color_med_atl[4]))
p1<-p
p<-ggplot(data=data_pca,aes(x=PC3,y=PC4,label=INDIV))+
theme_minimal()+
theme(panel.grid=element_blank(),
panel.border=element_rect(fill="transparent"),
plot.title=element_text(hjust=0.5))+
geom_hline(yintercept=0,lty=2)+
geom_vline(xintercept=0,lty=2)+
geom_point(size=3,aes(col=LOCA))+
xlab(paste("PCA 3 (",round(pca$varprop[3]*100,2),"% )",sep=""))+
ylab(paste("PCA 4 (",round(pca$varprop[4]*100,2),"% )",sep=""))+
scale_colour_manual(name="Location",
values=c(color_med_atl[2],
color_med_atl[1],
color_med_atl[3],
color_med_atl[4]))
p2<-p
data_varpop=data.frame(PC=factor(paste("P",seq(1,10),sep=""),levels=paste("P",seq(1,10),sep="")),VAR=pca$varprop[1:10])
pp<-ggplot(data_varpop,aes(x=PC,y=VAR))+
geom_bar(stat='identity',fill="dodgerblue2",alpha=0.25)+
theme_classic()+
xlab("Principal Component")+
ylab("Variation explained (%)")
```
```{r}
subplot(ggplotly(p1)%>% layout(legend = list(orientation = "h", x = 0.2, y =-0.15)), ggplotly(p2)%>%hide_legend(), ggplotly(pp)%>%hide_legend(), titleX=T,titleY=T,margin=0.035,widths=c(0.375,0.425,0.2),which_layout=1) %>% partial_bundle()
```
### maf = 0.50
```{r}
pca=PCA_list$All_filtered$maf0.5[[1]]
data_pca=data.frame(INDIV=pca$sample.id,
PC1=pca$eigenvect[,1],
PC2=pca$eigenvect[,2],
PC3=pca$eigenvect[,3],
PC4=pca$eigenvect[,4],
LOCA=c(rep("Algarve",5),
rep("Bay of Biscay",5),
rep("Gulf of Lion",5),
rep("Costa Calida",5)))
color_med_atl=rev(brewer.pal(n=4,name="RdBu"))
p<-ggplot(data=data_pca,aes(x=PC1,y=PC2,label=INDIV))+
theme_minimal()+
theme(panel.grid=element_blank(),
panel.border=element_rect(fill="transparent"),
plot.title=element_text(hjust=0.5))+
geom_hline(yintercept=0,lty=2)+
geom_vline(xintercept=0,lty=2)+
geom_point(size=3,aes(col=LOCA))+
xlab(paste("PCA 1 (",round(pca$varprop[1]*100,2),"% )",sep=""))+
ylab(paste("PCA 2 (",round(pca$varprop[2]*100,2),"% )",sep=""))+
scale_colour_manual(name="Location",
values=c(color_med_atl[2],
color_med_atl[1],
color_med_atl[3],
color_med_atl[4]))
p1<-p
p<-ggplot(data=data_pca,aes(x=PC3,y=PC4,label=INDIV))+
theme_minimal()+
theme(panel.grid=element_blank(),
panel.border=element_rect(fill="transparent"),
plot.title=element_text(hjust=0.5))+
geom_hline(yintercept=0,lty=2)+
geom_vline(xintercept=0,lty=2)+
geom_point(size=3,aes(col=LOCA))+
xlab(paste("PCA 3 (",round(pca$varprop[3]*100,2),"% )",sep=""))+
ylab(paste("PCA 4 (",round(pca$varprop[4]*100,2),"% )",sep=""))+
scale_colour_manual(name="Location",
values=c(color_med_atl[2],
color_med_atl[1],
color_med_atl[3],
color_med_atl[4]))
p2<-p
data_varpop=data.frame(PC=factor(paste("P",seq(1,10),sep=""),levels=paste("P",seq(1,10),sep="")),VAR=pca$varprop[1:10])
pp<-ggplot(data_varpop,aes(x=PC,y=VAR))+
geom_bar(stat='identity',fill="dodgerblue2",alpha=0.25)+
theme_classic()+
xlab("Principal Component")+
ylab("Variation explained (%)")
```
```{r}
subplot(ggplotly(p1)%>% layout(legend = list(orientation = "h", x = 0.2, y =-0.15)), ggplotly(p2)%>%hide_legend(), ggplotly(pp)%>%hide_legend(), titleX=T,titleY=T,margin=0.035,widths=c(0.375,0.425,0.2),which_layout=1) %>% partial_bundle()
```
Row {.tabset data-height=50}
-----------------------
<center>
<font size="6">**Pruned filtered SNPS**</font>
</center>
Row {.tabset data-height=600}
-----------------------
### maf = 0
```{r}
pca=PCA_list$Prune_filtered$maf0[[1]]
data_pca=data.frame(INDIV=pca$sample.id,
PC1=pca$eigenvect[,1],
PC2=pca$eigenvect[,2],
PC3=pca$eigenvect[,3],
PC4=pca$eigenvect[,4],
LOCA=c(rep("Algarve",5),
rep("Bay of Biscay",5),
rep("Gulf of Lion",5),
rep("Costa Calida",5)))
color_med_atl=rev(brewer.pal(n=4,name="RdBu"))
p<-ggplot(data=data_pca,aes(x=PC1,y=PC2,label=INDIV))+
theme_minimal()+
theme(panel.grid=element_blank(),
panel.border=element_rect(fill="transparent"),
plot.title=element_text(hjust=0.5))+
geom_hline(yintercept=0,lty=2)+
geom_vline(xintercept=0,lty=2)+
geom_point(size=3,aes(col=LOCA))+
xlab(paste("PCA 1 (",round(pca$varprop[1]*100,2),"% )",sep=""))+
ylab(paste("PCA 2 (",round(pca$varprop[2]*100,2),"% )",sep=""))+
scale_colour_manual(name="Location",
values=c(color_med_atl[2],
color_med_atl[1],
color_med_atl[3],
color_med_atl[4]))
p1<-p
p<-ggplot(data=data_pca,aes(x=PC3,y=PC4,label=INDIV))+
theme_minimal()+
theme(panel.grid=element_blank(),
panel.border=element_rect(fill="transparent"),
plot.title=element_text(hjust=0.5))+
geom_hline(yintercept=0,lty=2)+
geom_vline(xintercept=0,lty=2)+
geom_point(size=3,aes(col=LOCA))+
xlab(paste("PCA 3 (",round(pca$varprop[3]*100,2),"% )",sep=""))+
ylab(paste("PCA 4 (",round(pca$varprop[4]*100,2),"% )",sep=""))+
scale_colour_manual(name="Location",
values=c(color_med_atl[2],
color_med_atl[1],
color_med_atl[3],
color_med_atl[4]))
p2<-p
data_varpop=data.frame(PC=factor(paste("P",seq(1,10),sep=""),levels=paste("P",seq(1,10),sep="")),VAR=pca$varprop[1:10])
pp<-ggplot(data_varpop,aes(x=PC,y=VAR))+
geom_bar(stat='identity',fill="dodgerblue2",alpha=0.25)+
theme_classic()+
xlab("Principal Component")+
ylab("Variation explained (%)")
```
```{r}
subplot(ggplotly(p1)%>% layout(legend = list(orientation = "h", x = 0.2, y =-0.15)), ggplotly(p2)%>%hide_legend(), ggplotly(pp)%>%hide_legend(), titleX=T,titleY=T,margin=0.035,widths=c(0.375,0.425,0.2),which_layout=1) %>% partial_bundle()
```
### maf = 0.05
```{r}
pca=PCA_list$Prune_filtered$maf0.05[[1]]
data_pca=data.frame(INDIV=pca$sample.id,
PC1=pca$eigenvect[,1],
PC2=pca$eigenvect[,2],
PC3=pca$eigenvect[,3],
PC4=pca$eigenvect[,4],
LOCA=c(rep("Algarve",5),
rep("Bay of Biscay",5),
rep("Gulf of Lion",5),
rep("Costa Calida",5)))
color_med_atl=rev(brewer.pal(n=4,name="RdBu"))
p<-ggplot(data=data_pca,aes(x=PC1,y=PC2,label=INDIV))+
theme_minimal()+
theme(panel.grid=element_blank(),
panel.border=element_rect(fill="transparent"),
plot.title=element_text(hjust=0.5))+
geom_hline(yintercept=0,lty=2)+
geom_vline(xintercept=0,lty=2)+
geom_point(size=3,aes(col=LOCA))+
xlab(paste("PCA 1 (",round(pca$varprop[1]*100,2),"% )",sep=""))+
ylab(paste("PCA 2 (",round(pca$varprop[2]*100,2),"% )",sep=""))+
scale_colour_manual(name="Location",
values=c(color_med_atl[2],
color_med_atl[1],
color_med_atl[3],
color_med_atl[4]))
p1<-p
p<-ggplot(data=data_pca,aes(x=PC3,y=PC4,label=INDIV))+
theme_minimal()+
theme(panel.grid=element_blank(),
panel.border=element_rect(fill="transparent"),
plot.title=element_text(hjust=0.5))+
geom_hline(yintercept=0,lty=2)+
geom_vline(xintercept=0,lty=2)+
geom_point(size=3,aes(col=LOCA))+
xlab(paste("PCA 3 (",round(pca$varprop[3]*100,2),"% )",sep=""))+
ylab(paste("PCA 4 (",round(pca$varprop[4]*100,2),"% )",sep=""))+
scale_colour_manual(name="Location",
values=c(color_med_atl[2],
color_med_atl[1],
color_med_atl[3],
color_med_atl[4]))
p2<-p
data_varpop=data.frame(PC=factor(paste("P",seq(1,10),sep=""),levels=paste("P",seq(1,10),sep="")),VAR=pca$varprop[1:10])
pp<-ggplot(data_varpop,aes(x=PC,y=VAR))+
geom_bar(stat='identity',fill="dodgerblue2",alpha=0.25)+
theme_classic()+
xlab("Principal Component")+
ylab("Variation explained (%)")
```
```{r}
subplot(ggplotly(p1)%>% layout(legend = list(orientation = "h", x = 0.2, y =-0.15)), ggplotly(p2)%>%hide_legend(), ggplotly(pp)%>%hide_legend(), titleX=T,titleY=T,margin=0.035,widths=c(0.375,0.425,0.2),which_layout=1) %>% partial_bundle()
```
### maf = 0.1
```{r}
pca=PCA_list$Prune_filtered$maf0.1[[1]]
data_pca=data.frame(INDIV=pca$sample.id,
PC1=pca$eigenvect[,1],
PC2=pca$eigenvect[,2],
PC3=pca$eigenvect[,3],
PC4=pca$eigenvect[,4],
LOCA=c(rep("Algarve",5),
rep("Bay of Biscay",5),
rep("Gulf of Lion",5),
rep("Costa Calida",5)))
color_med_atl=rev(brewer.pal(n=4,name="RdBu"))
p<-ggplot(data=data_pca,aes(x=PC1,y=PC2,label=INDIV))+
theme_minimal()+
theme(panel.grid=element_blank(),
panel.border=element_rect(fill="transparent"),
plot.title=element_text(hjust=0.5))+
geom_hline(yintercept=0,lty=2)+
geom_vline(xintercept=0,lty=2)+
geom_point(size=3,aes(col=LOCA))+
xlab(paste("PCA 1 (",round(pca$varprop[1]*100,2),"% )",sep=""))+
ylab(paste("PCA 2 (",round(pca$varprop[2]*100,2),"% )",sep=""))+
scale_colour_manual(name="Location",
values=c(color_med_atl[2],
color_med_atl[1],
color_med_atl[3],
color_med_atl[4]))
p1<-p
p<-ggplot(data=data_pca,aes(x=PC3,y=PC4,label=INDIV))+
theme_minimal()+
theme(panel.grid=element_blank(),
panel.border=element_rect(fill="transparent"),
plot.title=element_text(hjust=0.5))+
geom_hline(yintercept=0,lty=2)+
geom_vline(xintercept=0,lty=2)+
geom_point(size=3,aes(col=LOCA))+
xlab(paste("PCA 3 (",round(pca$varprop[3]*100,2),"% )",sep=""))+
ylab(paste("PCA 4 (",round(pca$varprop[4]*100,2),"% )",sep=""))+
scale_colour_manual(name="Location",
values=c(color_med_atl[2],
color_med_atl[1],
color_med_atl[3],
color_med_atl[4]))
p2<-p
data_varpop=data.frame(PC=factor(paste("P",seq(1,10),sep=""),levels=paste("P",seq(1,10),sep="")),VAR=pca$varprop[1:10])
pp<-ggplot(data_varpop,aes(x=PC,y=VAR))+
geom_bar(stat='identity',fill="dodgerblue2",alpha=0.25)+
theme_classic()+
xlab("Principal Component")+
ylab("Variation explained (%)")
```
```{r}
subplot(ggplotly(p1)%>% layout(legend = list(orientation = "h", x = 0.2, y =-0.15)), ggplotly(p2)%>%hide_legend(), ggplotly(pp)%>%hide_legend(), titleX=T,titleY=T,margin=0.035,widths=c(0.375,0.425,0.2),which_layout=1) %>% partial_bundle()
```
### maf = 0.15
```{r}
pca=PCA_list$Prune_filtered$maf0.15[[1]]
data_pca=data.frame(INDIV=pca$sample.id,
PC1=pca$eigenvect[,1],
PC2=pca$eigenvect[,2],
PC3=pca$eigenvect[,3],
PC4=pca$eigenvect[,4],
LOCA=c(rep("Algarve",5),
rep("Bay of Biscay",5),
rep("Gulf of Lion",5),
rep("Costa Calida",5)))
color_med_atl=rev(brewer.pal(n=4,name="RdBu"))
p<-ggplot(data=data_pca,aes(x=PC1,y=PC2,label=INDIV))+
theme_minimal()+
theme(panel.grid=element_blank(),
panel.border=element_rect(fill="transparent"),
plot.title=element_text(hjust=0.5))+
geom_hline(yintercept=0,lty=2)+
geom_vline(xintercept=0,lty=2)+
geom_point(size=3,aes(col=LOCA))+
xlab(paste("PCA 1 (",round(pca$varprop[1]*100,2),"% )",sep=""))+
ylab(paste("PCA 2 (",round(pca$varprop[2]*100,2),"% )",sep=""))+
scale_colour_manual(name="Location",
values=c(color_med_atl[2],
color_med_atl[1],
color_med_atl[3],
color_med_atl[4]))
p1<-p
p<-ggplot(data=data_pca,aes(x=PC3,y=PC4,label=INDIV))+
theme_minimal()+
theme(panel.grid=element_blank(),
panel.border=element_rect(fill="transparent"),
plot.title=element_text(hjust=0.5))+
geom_hline(yintercept=0,lty=2)+
geom_vline(xintercept=0,lty=2)+
geom_point(size=3,aes(col=LOCA))+
xlab(paste("PCA 3 (",round(pca$varprop[3]*100,2),"% )",sep=""))+
ylab(paste("PCA 4 (",round(pca$varprop[4]*100,2),"% )",sep=""))+
scale_colour_manual(name="Location",
values=c(color_med_atl[2],
color_med_atl[1],
color_med_atl[3],
color_med_atl[4]))
p2<-p
data_varpop=data.frame(PC=factor(paste("P",seq(1,10),sep=""),levels=paste("P",seq(1,10),sep="")),VAR=pca$varprop[1:10])
pp<-ggplot(data_varpop,aes(x=PC,y=VAR))+
geom_bar(stat='identity',fill="dodgerblue2",alpha=0.25)+
theme_classic()+
xlab("Principal Component")+
ylab("Variation explained (%)")
```
```{r}
subplot(ggplotly(p1)%>% layout(legend = list(orientation = "h", x = 0.2, y =-0.15)), ggplotly(p2)%>%hide_legend(), ggplotly(pp)%>%hide_legend(), titleX=T,titleY=T,margin=0.035,widths=c(0.375,0.425,0.2),which_layout=1) %>% partial_bundle()
```
### maf = 0.20
```{r}
pca=PCA_list$Prune_filtered$maf0.2[[1]]
data_pca=data.frame(INDIV=pca$sample.id,
PC1=pca$eigenvect[,1],
PC2=pca$eigenvect[,2],
PC3=pca$eigenvect[,3],
PC4=pca$eigenvect[,4],
LOCA=c(rep("Algarve",5),
rep("Bay of Biscay",5),
rep("Gulf of Lion",5),
rep("Costa Calida",5)))
color_med_atl=rev(brewer.pal(n=4,name="RdBu"))
p<-ggplot(data=data_pca,aes(x=PC1,y=PC2,label=INDIV))+
theme_minimal()+
theme(panel.grid=element_blank(),
panel.border=element_rect(fill="transparent"),
plot.title=element_text(hjust=0.5))+
geom_hline(yintercept=0,lty=2)+
geom_vline(xintercept=0,lty=2)+
geom_point(size=3,aes(col=LOCA))+
xlab(paste("PCA 1 (",round(pca$varprop[1]*100,2),"% )",sep=""))+
ylab(paste("PCA 2 (",round(pca$varprop[2]*100,2),"% )",sep=""))+
scale_colour_manual(name="Location",
values=c(color_med_atl[2],
color_med_atl[1],
color_med_atl[3],
color_med_atl[4]))
p1<-p
p<-ggplot(data=data_pca,aes(x=PC3,y=PC4,label=INDIV))+
theme_minimal()+
theme(panel.grid=element_blank(),
panel.border=element_rect(fill="transparent"),
plot.title=element_text(hjust=0.5))+
geom_hline(yintercept=0,lty=2)+
geom_vline(xintercept=0,lty=2)+
geom_point(size=3,aes(col=LOCA))+
xlab(paste("PCA 3 (",round(pca$varprop[3]*100,2),"% )",sep=""))+
ylab(paste("PCA 4 (",round(pca$varprop[4]*100,2),"% )",sep=""))+
scale_colour_manual(name="Location",
values=c(color_med_atl[2],
color_med_atl[1],
color_med_atl[3],
color_med_atl[4]))
p2<-p
data_varpop=data.frame(PC=factor(paste("P",seq(1,10),sep=""),levels=paste("P",seq(1,10),sep="")),VAR=pca$varprop[1:10])
pp<-ggplot(data_varpop,aes(x=PC,y=VAR))+
geom_bar(stat='identity',fill="dodgerblue2",alpha=0.25)+
theme_classic()+
xlab("Principal Component")+
ylab("Variation explained (%)")
```
```{r}
subplot(ggplotly(p1)%>% layout(legend = list(orientation = "h", x = 0.2, y =-0.15)), ggplotly(p2)%>%hide_legend(), ggplotly(pp)%>%hide_legend(), titleX=T,titleY=T,margin=0.035,widths=c(0.375,0.425,0.2),which_layout=1) %>% partial_bundle()
```
### maf = 0.25
```{r}
pca=PCA_list$Prune_filtered$maf0.25[[1]]
data_pca=data.frame(INDIV=pca$sample.id,
PC1=pca$eigenvect[,1],
PC2=pca$eigenvect[,2],
PC3=pca$eigenvect[,3],
PC4=pca$eigenvect[,4],
LOCA=c(rep("Algarve",5),
rep("Bay of Biscay",5),
rep("Gulf of Lion",5),
rep("Costa Calida",5)))
color_med_atl=rev(brewer.pal(n=4,name="RdBu"))
p<-ggplot(data=data_pca,aes(x=PC1,y=PC2,label=INDIV))+
theme_minimal()+
theme(panel.grid=element_blank(),
panel.border=element_rect(fill="transparent"),
plot.title=element_text(hjust=0.5))+
geom_hline(yintercept=0,lty=2)+
geom_vline(xintercept=0,lty=2)+
geom_point(size=3,aes(col=LOCA))+
xlab(paste("PCA 1 (",round(pca$varprop[1]*100,2),"% )",sep=""))+
ylab(paste("PCA 2 (",round(pca$varprop[2]*100,2),"% )",sep=""))+
scale_colour_manual(name="Location",
values=c(color_med_atl[2],
color_med_atl[1],
color_med_atl[3],
color_med_atl[4]))
p1<-p
p<-ggplot(data=data_pca,aes(x=PC3,y=PC4,label=INDIV))+
theme_minimal()+
theme(panel.grid=element_blank(),
panel.border=element_rect(fill="transparent"),
plot.title=element_text(hjust=0.5))+
geom_hline(yintercept=0,lty=2)+
geom_vline(xintercept=0,lty=2)+
geom_point(size=3,aes(col=LOCA))+
xlab(paste("PCA 3 (",round(pca$varprop[3]*100,2),"% )",sep=""))+
ylab(paste("PCA 4 (",round(pca$varprop[4]*100,2),"% )",sep=""))+
scale_colour_manual(name="Location",
values=c(color_med_atl[2],
color_med_atl[1],
color_med_atl[3],
color_med_atl[4]))
p2<-p
data_varpop=data.frame(PC=factor(paste("P",seq(1,10),sep=""),levels=paste("P",seq(1,10),sep="")),VAR=pca$varprop[1:10])
pp<-ggplot(data_varpop,aes(x=PC,y=VAR))+
geom_bar(stat='identity',fill="dodgerblue2",alpha=0.25)+
theme_classic()+
xlab("Principal Component")+
ylab("Variation explained (%)")
```
```{r}
subplot(ggplotly(p1)%>% layout(legend = list(orientation = "h", x = 0.2, y =-0.15)), ggplotly(p2)%>%hide_legend(), ggplotly(pp)%>%hide_legend(), titleX=T,titleY=T,margin=0.035,widths=c(0.375,0.425,0.2),which_layout=1) %>% partial_bundle()
```
### maf = 0.30
```{r}
pca=PCA_list$Prune_filtered$maf0.3[[1]]
data_pca=data.frame(INDIV=pca$sample.id,
PC1=pca$eigenvect[,1],
PC2=pca$eigenvect[,2],
PC3=pca$eigenvect[,3],
PC4=pca$eigenvect[,4],
LOCA=c(rep("Algarve",5),
rep("Bay of Biscay",5),
rep("Gulf of Lion",5),
rep("Costa Calida",5)))
color_med_atl=rev(brewer.pal(n=4,name="RdBu"))
p<-ggplot(data=data_pca,aes(x=PC1,y=PC2,label=INDIV))+
theme_minimal()+
theme(panel.grid=element_blank(),
panel.border=element_rect(fill="transparent"),
plot.title=element_text(hjust=0.5))+
geom_hline(yintercept=0,lty=2)+
geom_vline(xintercept=0,lty=2)+
geom_point(size=3,aes(col=LOCA))+
xlab(paste("PCA 1 (",round(pca$varprop[1]*100,2),"% )",sep=""))+
ylab(paste("PCA 2 (",round(pca$varprop[2]*100,2),"% )",sep=""))+
scale_colour_manual(name="Location",
values=c(color_med_atl[2],
color_med_atl[1],
color_med_atl[3],
color_med_atl[4]))
p1<-p
p<-ggplot(data=data_pca,aes(x=PC3,y=PC4,label=INDIV))+
theme_minimal()+
theme(panel.grid=element_blank(),
panel.border=element_rect(fill="transparent"),
plot.title=element_text(hjust=0.5))+
geom_hline(yintercept=0,lty=2)+
geom_vline(xintercept=0,lty=2)+
geom_point(size=3,aes(col=LOCA))+
xlab(paste("PCA 3 (",round(pca$varprop[3]*100,2),"% )",sep=""))+
ylab(paste("PCA 4 (",round(pca$varprop[4]*100,2),"% )",sep=""))+
scale_colour_manual(name="Location",
values=c(color_med_atl[2],
color_med_atl[1],
color_med_atl[3],
color_med_atl[4]))
p2<-p
data_varpop=data.frame(PC=factor(paste("P",seq(1,10),sep=""),levels=paste("P",seq(1,10),sep="")),VAR=pca$varprop[1:10])
pp<-ggplot(data_varpop,aes(x=PC,y=VAR))+
geom_bar(stat='identity',fill="dodgerblue2",alpha=0.25)+
theme_classic()+
xlab("Principal Component")+
ylab("Variation explained (%)")
```
```{r}
subplot(ggplotly(p1)%>% layout(legend = list(orientation = "h", x = 0.2, y =-0.15)), ggplotly(p2)%>%hide_legend(), ggplotly(pp)%>%hide_legend(), titleX=T,titleY=T,margin=0.035,widths=c(0.375,0.425,0.2),which_layout=1) %>% partial_bundle()
```
### maf = 0.35
```{r}
pca=PCA_list$Prune_filtered$maf0.35[[1]]
data_pca=data.frame(INDIV=pca$sample.id,
PC1=pca$eigenvect[,1],
PC2=pca$eigenvect[,2],
PC3=pca$eigenvect[,3],
PC4=pca$eigenvect[,4],
LOCA=c(rep("Algarve",5),
rep("Bay of Biscay",5),
rep("Gulf of Lion",5),
rep("Costa Calida",5)))
color_med_atl=rev(brewer.pal(n=4,name="RdBu"))
p<-ggplot(data=data_pca,aes(x=PC1,y=PC2,label=INDIV))+
theme_minimal()+
theme(panel.grid=element_blank(),
panel.border=element_rect(fill="transparent"),
plot.title=element_text(hjust=0.5))+
geom_hline(yintercept=0,lty=2)+
geom_vline(xintercept=0,lty=2)+
geom_point(size=3,aes(col=LOCA))+
xlab(paste("PCA 1 (",round(pca$varprop[1]*100,2),"% )",sep=""))+
ylab(paste("PCA 2 (",round(pca$varprop[2]*100,2),"% )",sep=""))+
scale_colour_manual(name="Location",
values=c(color_med_atl[2],
color_med_atl[1],
color_med_atl[3],
color_med_atl[4]))
p1<-p
p<-ggplot(data=data_pca,aes(x=PC3,y=PC4,label=INDIV))+
theme_minimal()+
theme(panel.grid=element_blank(),
panel.border=element_rect(fill="transparent"),
plot.title=element_text(hjust=0.5))+
geom_hline(yintercept=0,lty=2)+
geom_vline(xintercept=0,lty=2)+
geom_point(size=3,aes(col=LOCA))+
xlab(paste("PCA 3 (",round(pca$varprop[3]*100,2),"% )",sep=""))+
ylab(paste("PCA 4 (",round(pca$varprop[4]*100,2),"% )",sep=""))+
scale_colour_manual(name="Location",
values=c(color_med_atl[2],
color_med_atl[1],
color_med_atl[3],
color_med_atl[4]))
p2<-p
data_varpop=data.frame(PC=factor(paste("P",seq(1,10),sep=""),levels=paste("P",seq(1,10),sep="")),VAR=pca$varprop[1:10])
pp<-ggplot(data_varpop,aes(x=PC,y=VAR))+
geom_bar(stat='identity',fill="dodgerblue2",alpha=0.25)+
theme_classic()+
xlab("Principal Component")+
ylab("Variation explained (%)")
```
```{r}
subplot(ggplotly(p1)%>% layout(legend = list(orientation = "h", x = 0.2, y =-0.15)), ggplotly(p2)%>%hide_legend(), ggplotly(pp)%>%hide_legend(), titleX=T,titleY=T,margin=0.035,widths=c(0.375,0.425,0.2),which_layout=1) %>% partial_bundle()
```
### maf = 0.40
```{r}
pca=PCA_list$Prune_filtered$maf0.4[[1]]
data_pca=data.frame(INDIV=pca$sample.id,
PC1=pca$eigenvect[,1],
PC2=pca$eigenvect[,2],
PC3=pca$eigenvect[,3],
PC4=pca$eigenvect[,4],
LOCA=c(rep("Algarve",5),
rep("Bay of Biscay",5),
rep("Gulf of Lion",5),
rep("Costa Calida",5)))
color_med_atl=rev(brewer.pal(n=4,name="RdBu"))
p<-ggplot(data=data_pca,aes(x=PC1,y=PC2,label=INDIV))+
theme_minimal()+
theme(panel.grid=element_blank(),
panel.border=element_rect(fill="transparent"),
plot.title=element_text(hjust=0.5))+
geom_hline(yintercept=0,lty=2)+
geom_vline(xintercept=0,lty=2)+
geom_point(size=3,aes(col=LOCA))+
xlab(paste("PCA 1 (",round(pca$varprop[1]*100,2),"% )",sep=""))+
ylab(paste("PCA 2 (",round(pca$varprop[2]*100,2),"% )",sep=""))+
scale_colour_manual(name="Location",
values=c(color_med_atl[2],
color_med_atl[1],
color_med_atl[3],
color_med_atl[4]))
p1<-p
p<-ggplot(data=data_pca,aes(x=PC3,y=PC4,label=INDIV))+
theme_minimal()+
theme(panel.grid=element_blank(),
panel.border=element_rect(fill="transparent"),
plot.title=element_text(hjust=0.5))+
geom_hline(yintercept=0,lty=2)+
geom_vline(xintercept=0,lty=2)+
geom_point(size=3,aes(col=LOCA))+
xlab(paste("PCA 3 (",round(pca$varprop[3]*100,2),"% )",sep=""))+
ylab(paste("PCA 4 (",round(pca$varprop[4]*100,2),"% )",sep=""))+
scale_colour_manual(name="Location",
values=c(color_med_atl[2],
color_med_atl[1],
color_med_atl[3],
color_med_atl[4]))
p2<-p
data_varpop=data.frame(PC=factor(paste("P",seq(1,10),sep=""),levels=paste("P",seq(1,10),sep="")),VAR=pca$varprop[1:10])
pp<-ggplot(data_varpop,aes(x=PC,y=VAR))+
geom_bar(stat='identity',fill="dodgerblue2",alpha=0.25)+
theme_classic()+
xlab("Principal Component")+
ylab("Variation explained (%)")
```
```{r}
subplot(ggplotly(p1)%>% layout(legend = list(orientation = "h", x = 0.2, y =-0.15)), ggplotly(p2)%>%hide_legend(), ggplotly(pp)%>%hide_legend(), titleX=T,titleY=T,margin=0.035,widths=c(0.375,0.425,0.2),which_layout=1) %>% partial_bundle()
```
### maf = 0.45
```{r}
pca=PCA_list$Prune_filtered$maf0.45[[1]]
data_pca=data.frame(INDIV=pca$sample.id,
PC1=pca$eigenvect[,1],
PC2=pca$eigenvect[,2],
PC3=pca$eigenvect[,3],
PC4=pca$eigenvect[,4],
LOCA=c(rep("Algarve",5),
rep("Bay of Biscay",5),
rep("Gulf of Lion",5),
rep("Costa Calida",5)))
color_med_atl=rev(brewer.pal(n=4,name="RdBu"))
p<-ggplot(data=data_pca,aes(x=PC1,y=PC2,label=INDIV))+
theme_minimal()+
theme(panel.grid=element_blank(),
panel.border=element_rect(fill="transparent"),
plot.title=element_text(hjust=0.5))+
geom_hline(yintercept=0,lty=2)+
geom_vline(xintercept=0,lty=2)+
geom_point(size=3,aes(col=LOCA))+
xlab(paste("PCA 1 (",round(pca$varprop[1]*100,2),"% )",sep=""))+
ylab(paste("PCA 2 (",round(pca$varprop[2]*100,2),"% )",sep=""))+
scale_colour_manual(name="Location",
values=c(color_med_atl[2],
color_med_atl[1],
color_med_atl[3],
color_med_atl[4]))
p1<-p
p<-ggplot(data=data_pca,aes(x=PC3,y=PC4,label=INDIV))+
theme_minimal()+
theme(panel.grid=element_blank(),
panel.border=element_rect(fill="transparent"),
plot.title=element_text(hjust=0.5))+
geom_hline(yintercept=0,lty=2)+
geom_vline(xintercept=0,lty=2)+
geom_point(size=3,aes(col=LOCA))+
xlab(paste("PCA 3 (",round(pca$varprop[3]*100,2),"% )",sep=""))+
ylab(paste("PCA 4 (",round(pca$varprop[4]*100,2),"% )",sep=""))+
scale_colour_manual(name="Location",
values=c(color_med_atl[2],
color_med_atl[1],
color_med_atl[3],
color_med_atl[4]))
p2<-p
data_varpop=data.frame(PC=factor(paste("P",seq(1,10),sep=""),levels=paste("P",seq(1,10),sep="")),VAR=pca$varprop[1:10])
pp<-ggplot(data_varpop,aes(x=PC,y=VAR))+
geom_bar(stat='identity',fill="dodgerblue2",alpha=0.25)+
theme_classic()+
xlab("Principal Component")+
ylab("Variation explained (%)")
```
```{r}
subplot(ggplotly(p1)%>% layout(legend = list(orientation = "h", x = 0.2, y =-0.15)), ggplotly(p2)%>%hide_legend(), ggplotly(pp)%>%hide_legend(), titleX=T,titleY=T,margin=0.035,widths=c(0.375,0.425,0.2),which_layout=1) %>% partial_bundle()
```
### maf = 0.50
```{r}
pca=PCA_list$Prune_filtered$maf0.5[[1]]
data_pca=data.frame(INDIV=pca$sample.id,
PC1=pca$eigenvect[,1],
PC2=pca$eigenvect[,2],
PC3=pca$eigenvect[,3],
PC4=pca$eigenvect[,4],
LOCA=c(rep("Algarve",5),
rep("Bay of Biscay",5),
rep("Gulf of Lion",5),
rep("Costa Calida",5)))
color_med_atl=rev(brewer.pal(n=4,name="RdBu"))
p<-ggplot(data=data_pca,aes(x=PC1,y=PC2,label=INDIV))+
theme_minimal()+
theme(panel.grid=element_blank(),
panel.border=element_rect(fill="transparent"),
plot.title=element_text(hjust=0.5))+
geom_hline(yintercept=0,lty=2)+
geom_vline(xintercept=0,lty=2)+
geom_point(size=3,aes(col=LOCA))+
xlab(paste("PCA 1 (",round(pca$varprop[1]*100,2),"% )",sep=""))+
ylab(paste("PCA 2 (",round(pca$varprop[2]*100,2),"% )",sep=""))+
scale_colour_manual(name="Location",
values=c(color_med_atl[2],
color_med_atl[1],
color_med_atl[3],
color_med_atl[4]))
p1<-p
p<-ggplot(data=data_pca,aes(x=PC3,y=PC4,label=INDIV))+
theme_minimal()+
theme(panel.grid=element_blank(),
panel.border=element_rect(fill="transparent"),
plot.title=element_text(hjust=0.5))+
geom_hline(yintercept=0,lty=2)+
geom_vline(xintercept=0,lty=2)+
geom_point(size=3,aes(col=LOCA))+
xlab(paste("PCA 3 (",round(pca$varprop[3]*100,2),"% )",sep=""))+
ylab(paste("PCA 4 (",round(pca$varprop[4]*100,2),"% )",sep=""))+
scale_colour_manual(name="Location",
values=c(color_med_atl[2],
color_med_atl[1],
color_med_atl[3],
color_med_atl[4]))
p2<-p
data_varpop=data.frame(PC=factor(paste("P",seq(1,10),sep=""),levels=paste("P",seq(1,10),sep="")),VAR=pca$varprop[1:10])
pp<-ggplot(data_varpop,aes(x=PC,y=VAR))+
geom_bar(stat='identity',fill="dodgerblue2",alpha=0.25)+
theme_classic()+
xlab("Principal Component")+
ylab("Variation explained (%)")
```
```{r}
subplot(ggplotly(p1)%>% layout(legend = list(orientation = "h", x = 0.2, y =-0.15)), ggplotly(p2)%>%hide_legend(), ggplotly(pp)%>%hide_legend(), titleX=T,titleY=T,margin=0.035,widths=c(0.375,0.425,0.2),which_layout=1) %>% partial_bundle()
```
Row {.tabset data-height=50}
-----------------------
<center>
<font size="6">**All unfiltered SNPS**</font>
</center>
Row {.tabset data-height=600}
-----------------------
### maf = 0
```{r}
pca=PCA_list$All_unfiltered$maf0[[1]]
data_pca=data.frame(INDIV=pca$sample.id,
PC1=pca$eigenvect[,1],
PC2=pca$eigenvect[,2],
PC3=pca$eigenvect[,3],
PC4=pca$eigenvect[,4],
LOCA=c(rep("Algarve",5),
rep("Bay of Biscay",5),
rep("Gulf of Lion",5),
rep("Costa Calida",5)))
color_med_atl=rev(brewer.pal(n=4,name="RdBu"))
p<-ggplot(data=data_pca,aes(x=PC1,y=PC2,label=INDIV))+
theme_minimal()+
theme(panel.grid=element_blank(),
panel.border=element_rect(fill="transparent"),
plot.title=element_text(hjust=0.5))+
geom_hline(yintercept=0,lty=2)+
geom_vline(xintercept=0,lty=2)+
geom_point(size=3,aes(col=LOCA))+
xlab(paste("PCA 1 (",round(pca$varprop[1]*100,2),"% )",sep=""))+
ylab(paste("PCA 2 (",round(pca$varprop[2]*100,2),"% )",sep=""))+
scale_colour_manual(name="Location",
values=c(color_med_atl[2],
color_med_atl[1],
color_med_atl[3],
color_med_atl[4]))
p1<-p
p<-ggplot(data=data_pca,aes(x=PC3,y=PC4,label=INDIV))+
theme_minimal()+
theme(panel.grid=element_blank(),
panel.border=element_rect(fill="transparent"),
plot.title=element_text(hjust=0.5))+
geom_hline(yintercept=0,lty=2)+
geom_vline(xintercept=0,lty=2)+
geom_point(size=3,aes(col=LOCA))+
xlab(paste("PCA 3 (",round(pca$varprop[3]*100,2),"% )",sep=""))+
ylab(paste("PCA 4 (",round(pca$varprop[4]*100,2),"% )",sep=""))+
scale_colour_manual(name="Location",
values=c(color_med_atl[2],
color_med_atl[1],
color_med_atl[3],
color_med_atl[4]))
p2<-p
data_varpop=data.frame(PC=factor(paste("P",seq(1,10),sep=""),levels=paste("P",seq(1,10),sep="")),VAR=pca$varprop[1:10])
pp<-ggplot(data_varpop,aes(x=PC,y=VAR))+
geom_bar(stat='identity',fill="dodgerblue2",alpha=0.25)+
theme_classic()+
xlab("Principal Component")+
ylab("Variation explained (%)")
```
```{r}
subplot(ggplotly(p1)%>% layout(legend = list(orientation = "h", x = 0.2, y =-0.15)), ggplotly(p2)%>%hide_legend(), ggplotly(pp)%>%hide_legend(), titleX=T,titleY=T,margin=0.035,widths=c(0.375,0.425,0.2),which_layout=1) %>% partial_bundle()
```
### maf = 0.05
```{r}
pca=PCA_list$All_unfiltered$maf0.05[[1]]
data_pca=data.frame(INDIV=pca$sample.id,
PC1=pca$eigenvect[,1],
PC2=pca$eigenvect[,2],
PC3=pca$eigenvect[,3],
PC4=pca$eigenvect[,4],
LOCA=c(rep("Algarve",5),
rep("Bay of Biscay",5),
rep("Gulf of Lion",5),
rep("Costa Calida",5)))
color_med_atl=rev(brewer.pal(n=4,name="RdBu"))
p<-ggplot(data=data_pca,aes(x=PC1,y=PC2,label=INDIV))+
theme_minimal()+
theme(panel.grid=element_blank(),
panel.border=element_rect(fill="transparent"),
plot.title=element_text(hjust=0.5))+
geom_hline(yintercept=0,lty=2)+
geom_vline(xintercept=0,lty=2)+
geom_point(size=3,aes(col=LOCA))+
xlab(paste("PCA 1 (",round(pca$varprop[1]*100,2),"% )",sep=""))+
ylab(paste("PCA 2 (",round(pca$varprop[2]*100,2),"% )",sep=""))+
scale_colour_manual(name="Location",
values=c(color_med_atl[2],
color_med_atl[1],
color_med_atl[3],
color_med_atl[4]))
p1<-p
p<-ggplot(data=data_pca,aes(x=PC3,y=PC4,label=INDIV))+
theme_minimal()+
theme(panel.grid=element_blank(),
panel.border=element_rect(fill="transparent"),
plot.title=element_text(hjust=0.5))+
geom_hline(yintercept=0,lty=2)+
geom_vline(xintercept=0,lty=2)+
geom_point(size=3,aes(col=LOCA))+
xlab(paste("PCA 3 (",round(pca$varprop[3]*100,2),"% )",sep=""))+
ylab(paste("PCA 4 (",round(pca$varprop[4]*100,2),"% )",sep=""))+
scale_colour_manual(name="Location",
values=c(color_med_atl[2],
color_med_atl[1],
color_med_atl[3],
color_med_atl[4]))
p2<-p
data_varpop=data.frame(PC=factor(paste("P",seq(1,10),sep=""),levels=paste("P",seq(1,10),sep="")),VAR=pca$varprop[1:10])
pp<-ggplot(data_varpop,aes(x=PC,y=VAR))+
geom_bar(stat='identity',fill="dodgerblue2",alpha=0.25)+
theme_classic()+
xlab("Principal Component")+
ylab("Variation explained (%)")
```
```{r}
subplot(ggplotly(p1)%>% layout(legend = list(orientation = "h", x = 0.2, y =-0.15)), ggplotly(p2)%>%hide_legend(), ggplotly(pp)%>%hide_legend(), titleX=T,titleY=T,margin=0.035,widths=c(0.375,0.425,0.2),which_layout=1) %>% partial_bundle()
```
### maf = 0.1
```{r}
pca=PCA_list$All_unfiltered$maf0.1[[1]]
data_pca=data.frame(INDIV=pca$sample.id,
PC1=pca$eigenvect[,1],
PC2=pca$eigenvect[,2],
PC3=pca$eigenvect[,3],
PC4=pca$eigenvect[,4],
LOCA=c(rep("Algarve",5),
rep("Bay of Biscay",5),
rep("Gulf of Lion",5),
rep("Costa Calida",5)))
color_med_atl=rev(brewer.pal(n=4,name="RdBu"))
p<-ggplot(data=data_pca,aes(x=PC1,y=PC2,label=INDIV))+
theme_minimal()+
theme(panel.grid=element_blank(),
panel.border=element_rect(fill="transparent"),
plot.title=element_text(hjust=0.5))+
geom_hline(yintercept=0,lty=2)+
geom_vline(xintercept=0,lty=2)+
geom_point(size=3,aes(col=LOCA))+
xlab(paste("PCA 1 (",round(pca$varprop[1]*100,2),"% )",sep=""))+
ylab(paste("PCA 2 (",round(pca$varprop[2]*100,2),"% )",sep=""))+
scale_colour_manual(name="Location",
values=c(color_med_atl[2],
color_med_atl[1],
color_med_atl[3],
color_med_atl[4]))
p1<-p
p<-ggplot(data=data_pca,aes(x=PC3,y=PC4,label=INDIV))+
theme_minimal()+
theme(panel.grid=element_blank(),
panel.border=element_rect(fill="transparent"),
plot.title=element_text(hjust=0.5))+
geom_hline(yintercept=0,lty=2)+
geom_vline(xintercept=0,lty=2)+
geom_point(size=3,aes(col=LOCA))+
xlab(paste("PCA 3 (",round(pca$varprop[3]*100,2),"% )",sep=""))+
ylab(paste("PCA 4 (",round(pca$varprop[4]*100,2),"% )",sep=""))+
scale_colour_manual(name="Location",
values=c(color_med_atl[2],
color_med_atl[1],
color_med_atl[3],
color_med_atl[4]))
p2<-p
data_varpop=data.frame(PC=factor(paste("P",seq(1,10),sep=""),levels=paste("P",seq(1,10),sep="")),VAR=pca$varprop[1:10])
pp<-ggplot(data_varpop,aes(x=PC,y=VAR))+
geom_bar(stat='identity',fill="dodgerblue2",alpha=0.25)+
theme_classic()+
xlab("Principal Component")+
ylab("Variation explained (%)")
```
```{r}
subplot(ggplotly(p1)%>% layout(legend = list(orientation = "h", x = 0.2, y =-0.15)), ggplotly(p2)%>%hide_legend(), ggplotly(pp)%>%hide_legend(), titleX=T,titleY=T,margin=0.035,widths=c(0.375,0.425,0.2),which_layout=1) %>% partial_bundle()
```
### maf = 0.15
```{r}
pca=PCA_list$All_unfiltered$maf0.15[[1]]
data_pca=data.frame(INDIV=pca$sample.id,
PC1=pca$eigenvect[,1],
PC2=pca$eigenvect[,2],
PC3=pca$eigenvect[,3],
PC4=pca$eigenvect[,4],
LOCA=c(rep("Algarve",5),
rep("Bay of Biscay",5),
rep("Gulf of Lion",5),
rep("Costa Calida",5)))
color_med_atl=rev(brewer.pal(n=4,name="RdBu"))
p<-ggplot(data=data_pca,aes(x=PC1,y=PC2,label=INDIV))+
theme_minimal()+
theme(panel.grid=element_blank(),
panel.border=element_rect(fill="transparent"),
plot.title=element_text(hjust=0.5))+
geom_hline(yintercept=0,lty=2)+
geom_vline(xintercept=0,lty=2)+
geom_point(size=3,aes(col=LOCA))+
xlab(paste("PCA 1 (",round(pca$varprop[1]*100,2),"% )",sep=""))+
ylab(paste("PCA 2 (",round(pca$varprop[2]*100,2),"% )",sep=""))+
scale_colour_manual(name="Location",
values=c(color_med_atl[2],
color_med_atl[1],
color_med_atl[3],
color_med_atl[4]))
p1<-p
p<-ggplot(data=data_pca,aes(x=PC3,y=PC4,label=INDIV))+
theme_minimal()+
theme(panel.grid=element_blank(),
panel.border=element_rect(fill="transparent"),
plot.title=element_text(hjust=0.5))+
geom_hline(yintercept=0,lty=2)+
geom_vline(xintercept=0,lty=2)+
geom_point(size=3,aes(col=LOCA))+
xlab(paste("PCA 3 (",round(pca$varprop[3]*100,2),"% )",sep=""))+
ylab(paste("PCA 4 (",round(pca$varprop[4]*100,2),"% )",sep=""))+
scale_colour_manual(name="Location",
values=c(color_med_atl[2],
color_med_atl[1],
color_med_atl[3],
color_med_atl[4]))
p2<-p
data_varpop=data.frame(PC=factor(paste("P",seq(1,10),sep=""),levels=paste("P",seq(1,10),sep="")),VAR=pca$varprop[1:10])
pp<-ggplot(data_varpop,aes(x=PC,y=VAR))+
geom_bar(stat='identity',fill="dodgerblue2",alpha=0.25)+
theme_classic()+
xlab("Principal Component")+
ylab("Variation explained (%)")
```
```{r}
subplot(ggplotly(p1)%>% layout(legend = list(orientation = "h", x = 0.2, y =-0.15)), ggplotly(p2)%>%hide_legend(), ggplotly(pp)%>%hide_legend(), titleX=T,titleY=T,margin=0.035,widths=c(0.375,0.425,0.2),which_layout=1) %>% partial_bundle()
```
### maf = 0.20
```{r}
pca=PCA_list$All_unfiltered$maf0.2[[1]]
data_pca=data.frame(INDIV=pca$sample.id,
PC1=pca$eigenvect[,1],
PC2=pca$eigenvect[,2],
PC3=pca$eigenvect[,3],
PC4=pca$eigenvect[,4],
LOCA=c(rep("Algarve",5),
rep("Bay of Biscay",5),
rep("Gulf of Lion",5),
rep("Costa Calida",5)))
color_med_atl=rev(brewer.pal(n=4,name="RdBu"))
p<-ggplot(data=data_pca,aes(x=PC1,y=PC2,label=INDIV))+
theme_minimal()+
theme(panel.grid=element_blank(),
panel.border=element_rect(fill="transparent"),
plot.title=element_text(hjust=0.5))+
geom_hline(yintercept=0,lty=2)+
geom_vline(xintercept=0,lty=2)+
geom_point(size=3,aes(col=LOCA))+
xlab(paste("PCA 1 (",round(pca$varprop[1]*100,2),"% )",sep=""))+
ylab(paste("PCA 2 (",round(pca$varprop[2]*100,2),"% )",sep=""))+
scale_colour_manual(name="Location",
values=c(color_med_atl[2],
color_med_atl[1],
color_med_atl[3],
color_med_atl[4]))
p1<-p
p<-ggplot(data=data_pca,aes(x=PC3,y=PC4,label=INDIV))+
theme_minimal()+
theme(panel.grid=element_blank(),
panel.border=element_rect(fill="transparent"),
plot.title=element_text(hjust=0.5))+
geom_hline(yintercept=0,lty=2)+
geom_vline(xintercept=0,lty=2)+
geom_point(size=3,aes(col=LOCA))+
xlab(paste("PCA 3 (",round(pca$varprop[3]*100,2),"% )",sep=""))+
ylab(paste("PCA 4 (",round(pca$varprop[4]*100,2),"% )",sep=""))+
scale_colour_manual(name="Location",
values=c(color_med_atl[2],
color_med_atl[1],
color_med_atl[3],
color_med_atl[4]))
p2<-p
data_varpop=data.frame(PC=factor(paste("P",seq(1,10),sep=""),levels=paste("P",seq(1,10),sep="")),VAR=pca$varprop[1:10])
pp<-ggplot(data_varpop,aes(x=PC,y=VAR))+
geom_bar(stat='identity',fill="dodgerblue2",alpha=0.25)+
theme_classic()+
xlab("Principal Component")+
ylab("Variation explained (%)")
```
```{r}
subplot(ggplotly(p1)%>% layout(legend = list(orientation = "h", x = 0.2, y =-0.15)), ggplotly(p2)%>%hide_legend(), ggplotly(pp)%>%hide_legend(), titleX=T,titleY=T,margin=0.035,widths=c(0.375,0.425,0.2),which_layout=1) %>% partial_bundle()
```
### maf = 0.25
```{r}
pca=PCA_list$All_unfiltered$maf0.25[[1]]
data_pca=data.frame(INDIV=pca$sample.id,
PC1=pca$eigenvect[,1],
PC2=pca$eigenvect[,2],
PC3=pca$eigenvect[,3],
PC4=pca$eigenvect[,4],
LOCA=c(rep("Algarve",5),
rep("Bay of Biscay",5),
rep("Gulf of Lion",5),
rep("Costa Calida",5)))
color_med_atl=rev(brewer.pal(n=4,name="RdBu"))
p<-ggplot(data=data_pca,aes(x=PC1,y=PC2,label=INDIV))+
theme_minimal()+
theme(panel.grid=element_blank(),
panel.border=element_rect(fill="transparent"),
plot.title=element_text(hjust=0.5))+
geom_hline(yintercept=0,lty=2)+
geom_vline(xintercept=0,lty=2)+
geom_point(size=3,aes(col=LOCA))+
xlab(paste("PCA 1 (",round(pca$varprop[1]*100,2),"% )",sep=""))+
ylab(paste("PCA 2 (",round(pca$varprop[2]*100,2),"% )",sep=""))+
scale_colour_manual(name="Location",
values=c(color_med_atl[2],
color_med_atl[1],
color_med_atl[3],
color_med_atl[4]))
p1<-p
p<-ggplot(data=data_pca,aes(x=PC3,y=PC4,label=INDIV))+
theme_minimal()+
theme(panel.grid=element_blank(),
panel.border=element_rect(fill="transparent"),
plot.title=element_text(hjust=0.5))+
geom_hline(yintercept=0,lty=2)+
geom_vline(xintercept=0,lty=2)+
geom_point(size=3,aes(col=LOCA))+
xlab(paste("PCA 3 (",round(pca$varprop[3]*100,2),"% )",sep=""))+
ylab(paste("PCA 4 (",round(pca$varprop[4]*100,2),"% )",sep=""))+
scale_colour_manual(name="Location",
values=c(color_med_atl[2],
color_med_atl[1],
color_med_atl[3],
color_med_atl[4]))
p2<-p
data_varpop=data.frame(PC=factor(paste("P",seq(1,10),sep=""),levels=paste("P",seq(1,10),sep="")),VAR=pca$varprop[1:10])
pp<-ggplot(data_varpop,aes(x=PC,y=VAR))+
geom_bar(stat='identity',fill="dodgerblue2",alpha=0.25)+
theme_classic()+
xlab("Principal Component")+
ylab("Variation explained (%)")
```
```{r}
subplot(ggplotly(p1)%>% layout(legend = list(orientation = "h", x = 0.2, y =-0.15)), ggplotly(p2)%>%hide_legend(), ggplotly(pp)%>%hide_legend(), titleX=T,titleY=T,margin=0.035,widths=c(0.375,0.425,0.2),which_layout=1) %>% partial_bundle()
```
### maf = 0.30
```{r}
pca=PCA_list$All_unfiltered$maf0.3[[1]]
data_pca=data.frame(INDIV=pca$sample.id,
PC1=pca$eigenvect[,1],
PC2=pca$eigenvect[,2],
PC3=pca$eigenvect[,3],
PC4=pca$eigenvect[,4],
LOCA=c(rep("Algarve",5),
rep("Bay of Biscay",5),
rep("Gulf of Lion",5),
rep("Costa Calida",5)))
color_med_atl=rev(brewer.pal(n=4,name="RdBu"))
p<-ggplot(data=data_pca,aes(x=PC1,y=PC2,label=INDIV))+
theme_minimal()+
theme(panel.grid=element_blank(),
panel.border=element_rect(fill="transparent"),
plot.title=element_text(hjust=0.5))+
geom_hline(yintercept=0,lty=2)+
geom_vline(xintercept=0,lty=2)+
geom_point(size=3,aes(col=LOCA))+
xlab(paste("PCA 1 (",round(pca$varprop[1]*100,2),"% )",sep=""))+
ylab(paste("PCA 2 (",round(pca$varprop[2]*100,2),"% )",sep=""))+
scale_colour_manual(name="Location",
values=c(color_med_atl[2],
color_med_atl[1],
color_med_atl[3],
color_med_atl[4]))
p1<-p
p<-ggplot(data=data_pca,aes(x=PC3,y=PC4,label=INDIV))+
theme_minimal()+
theme(panel.grid=element_blank(),
panel.border=element_rect(fill="transparent"),
plot.title=element_text(hjust=0.5))+
geom_hline(yintercept=0,lty=2)+
geom_vline(xintercept=0,lty=2)+
geom_point(size=3,aes(col=LOCA))+
xlab(paste("PCA 3 (",round(pca$varprop[3]*100,2),"% )",sep=""))+
ylab(paste("PCA 4 (",round(pca$varprop[4]*100,2),"% )",sep=""))+
scale_colour_manual(name="Location",
values=c(color_med_atl[2],
color_med_atl[1],
color_med_atl[3],
color_med_atl[4]))
p2<-p
data_varpop=data.frame(PC=factor(paste("P",seq(1,10),sep=""),levels=paste("P",seq(1,10),sep="")),VAR=pca$varprop[1:10])
pp<-ggplot(data_varpop,aes(x=PC,y=VAR))+
geom_bar(stat='identity',fill="dodgerblue2",alpha=0.25)+
theme_classic()+
xlab("Principal Component")+
ylab("Variation explained (%)")
```
```{r}
subplot(ggplotly(p1)%>% layout(legend = list(orientation = "h", x = 0.2, y =-0.15)), ggplotly(p2)%>%hide_legend(), ggplotly(pp)%>%hide_legend(), titleX=T,titleY=T,margin=0.035,widths=c(0.375,0.425,0.2),which_layout=1) %>% partial_bundle()
```
### maf = 0.35
```{r}
pca=PCA_list$All_unfiltered$maf0.35[[1]]
data_pca=data.frame(INDIV=pca$sample.id,
PC1=pca$eigenvect[,1],
PC2=pca$eigenvect[,2],
PC3=pca$eigenvect[,3],
PC4=pca$eigenvect[,4],
LOCA=c(rep("Algarve",5),
rep("Bay of Biscay",5),
rep("Gulf of Lion",5),
rep("Costa Calida",5)))
color_med_atl=rev(brewer.pal(n=4,name="RdBu"))
p<-ggplot(data=data_pca,aes(x=PC1,y=PC2,label=INDIV))+
theme_minimal()+
theme(panel.grid=element_blank(),
panel.border=element_rect(fill="transparent"),
plot.title=element_text(hjust=0.5))+
geom_hline(yintercept=0,lty=2)+
geom_vline(xintercept=0,lty=2)+
geom_point(size=3,aes(col=LOCA))+
xlab(paste("PCA 1 (",round(pca$varprop[1]*100,2),"% )",sep=""))+
ylab(paste("PCA 2 (",round(pca$varprop[2]*100,2),"% )",sep=""))+
scale_colour_manual(name="Location",
values=c(color_med_atl[2],
color_med_atl[1],
color_med_atl[3],
color_med_atl[4]))
p1<-p
p<-ggplot(data=data_pca,aes(x=PC3,y=PC4,label=INDIV))+
theme_minimal()+
theme(panel.grid=element_blank(),
panel.border=element_rect(fill="transparent"),
plot.title=element_text(hjust=0.5))+
geom_hline(yintercept=0,lty=2)+
geom_vline(xintercept=0,lty=2)+
geom_point(size=3,aes(col=LOCA))+
xlab(paste("PCA 3 (",round(pca$varprop[3]*100,2),"% )",sep=""))+
ylab(paste("PCA 4 (",round(pca$varprop[4]*100,2),"% )",sep=""))+
scale_colour_manual(name="Location",
values=c(color_med_atl[2],
color_med_atl[1],
color_med_atl[3],
color_med_atl[4]))
p2<-p
data_varpop=data.frame(PC=factor(paste("P",seq(1,10),sep=""),levels=paste("P",seq(1,10),sep="")),VAR=pca$varprop[1:10])
pp<-ggplot(data_varpop,aes(x=PC,y=VAR))+
geom_bar(stat='identity',fill="dodgerblue2",alpha=0.25)+
theme_classic()+
xlab("Principal Component")+
ylab("Variation explained (%)")
```
```{r}
subplot(ggplotly(p1)%>% layout(legend = list(orientation = "h", x = 0.2, y =-0.15)), ggplotly(p2)%>%hide_legend(), ggplotly(pp)%>%hide_legend(), titleX=T,titleY=T,margin=0.035,widths=c(0.375,0.425,0.2),which_layout=1) %>% partial_bundle()
```
### maf = 0.40
```{r}
pca=PCA_list$All_unfiltered$maf0.4[[1]]
data_pca=data.frame(INDIV=pca$sample.id,
PC1=pca$eigenvect[,1],
PC2=pca$eigenvect[,2],
PC3=pca$eigenvect[,3],
PC4=pca$eigenvect[,4],
LOCA=c(rep("Algarve",5),
rep("Bay of Biscay",5),
rep("Gulf of Lion",5),
rep("Costa Calida",5)))
color_med_atl=rev(brewer.pal(n=4,name="RdBu"))
p<-ggplot(data=data_pca,aes(x=PC1,y=PC2,label=INDIV))+
theme_minimal()+
theme(panel.grid=element_blank(),
panel.border=element_rect(fill="transparent"),
plot.title=element_text(hjust=0.5))+
geom_hline(yintercept=0,lty=2)+
geom_vline(xintercept=0,lty=2)+
geom_point(size=3,aes(col=LOCA))+
xlab(paste("PCA 1 (",round(pca$varprop[1]*100,2),"% )",sep=""))+
ylab(paste("PCA 2 (",round(pca$varprop[2]*100,2),"% )",sep=""))+
scale_colour_manual(name="Location",
values=c(color_med_atl[2],
color_med_atl[1],
color_med_atl[3],
color_med_atl[4]))
p1<-p
p<-ggplot(data=data_pca,aes(x=PC3,y=PC4,label=INDIV))+
theme_minimal()+
theme(panel.grid=element_blank(),
panel.border=element_rect(fill="transparent"),
plot.title=element_text(hjust=0.5))+
geom_hline(yintercept=0,lty=2)+
geom_vline(xintercept=0,lty=2)+
geom_point(size=3,aes(col=LOCA))+
xlab(paste("PCA 3 (",round(pca$varprop[3]*100,2),"% )",sep=""))+
ylab(paste("PCA 4 (",round(pca$varprop[4]*100,2),"% )",sep=""))+
scale_colour_manual(name="Location",
values=c(color_med_atl[2],
color_med_atl[1],
color_med_atl[3],
color_med_atl[4]))
p2<-p
data_varpop=data.frame(PC=factor(paste("P",seq(1,10),sep=""),levels=paste("P",seq(1,10),sep="")),VAR=pca$varprop[1:10])
pp<-ggplot(data_varpop,aes(x=PC,y=VAR))+
geom_bar(stat='identity',fill="dodgerblue2",alpha=0.25)+
theme_classic()+
xlab("Principal Component")+
ylab("Variation explained (%)")
```
```{r}
subplot(ggplotly(p1)%>% layout(legend = list(orientation = "h", x = 0.2, y =-0.15)), ggplotly(p2)%>%hide_legend(), ggplotly(pp)%>%hide_legend(), titleX=T,titleY=T,margin=0.035,widths=c(0.375,0.425,0.2),which_layout=1) %>% partial_bundle()
```
### maf = 0.45
```{r}
pca=PCA_list$All_unfiltered$maf0.45[[1]]
data_pca=data.frame(INDIV=pca$sample.id,
PC1=pca$eigenvect[,1],
PC2=pca$eigenvect[,2],
PC3=pca$eigenvect[,3],
PC4=pca$eigenvect[,4],
LOCA=c(rep("Algarve",5),
rep("Bay of Biscay",5),
rep("Gulf of Lion",5),
rep("Costa Calida",5)))
color_med_atl=rev(brewer.pal(n=4,name="RdBu"))
p<-ggplot(data=data_pca,aes(x=PC1,y=PC2,label=INDIV))+
theme_minimal()+
theme(panel.grid=element_blank(),
panel.border=element_rect(fill="transparent"),
plot.title=element_text(hjust=0.5))+
geom_hline(yintercept=0,lty=2)+
geom_vline(xintercept=0,lty=2)+
geom_point(size=3,aes(col=LOCA))+
xlab(paste("PCA 1 (",round(pca$varprop[1]*100,2),"% )",sep=""))+
ylab(paste("PCA 2 (",round(pca$varprop[2]*100,2),"% )",sep=""))+
scale_colour_manual(name="Location",
values=c(color_med_atl[2],
color_med_atl[1],
color_med_atl[3],
color_med_atl[4]))
p1<-p
p<-ggplot(data=data_pca,aes(x=PC3,y=PC4,label=INDIV))+
theme_minimal()+
theme(panel.grid=element_blank(),
panel.border=element_rect(fill="transparent"),
plot.title=element_text(hjust=0.5))+
geom_hline(yintercept=0,lty=2)+
geom_vline(xintercept=0,lty=2)+
geom_point(size=3,aes(col=LOCA))+
xlab(paste("PCA 3 (",round(pca$varprop[3]*100,2),"% )",sep=""))+
ylab(paste("PCA 4 (",round(pca$varprop[4]*100,2),"% )",sep=""))+
scale_colour_manual(name="Location",
values=c(color_med_atl[2],
color_med_atl[1],
color_med_atl[3],
color_med_atl[4]))
p2<-p
data_varpop=data.frame(PC=factor(paste("P",seq(1,10),sep=""),levels=paste("P",seq(1,10),sep="")),VAR=pca$varprop[1:10])
pp<-ggplot(data_varpop,aes(x=PC,y=VAR))+
geom_bar(stat='identity',fill="dodgerblue2",alpha=0.25)+
theme_classic()+
xlab("Principal Component")+
ylab("Variation explained (%)")
```
```{r}
subplot(ggplotly(p1)%>% layout(legend = list(orientation = "h", x = 0.2, y =-0.15)), ggplotly(p2)%>%hide_legend(), ggplotly(pp)%>%hide_legend(), titleX=T,titleY=T,margin=0.035,widths=c(0.375,0.425,0.2),which_layout=1) %>% partial_bundle()
```
### maf = 0.50
```{r}
pca=PCA_list$All_unfiltered$maf0.5[[1]]
data_pca=data.frame(INDIV=pca$sample.id,
PC1=pca$eigenvect[,1],
PC2=pca$eigenvect[,2],
PC3=pca$eigenvect[,3],
PC4=pca$eigenvect[,4],
LOCA=c(rep("Algarve",5),
rep("Bay of Biscay",5),
rep("Gulf of Lion",5),
rep("Costa Calida",5)))
color_med_atl=rev(brewer.pal(n=4,name="RdBu"))
p<-ggplot(data=data_pca,aes(x=PC1,y=PC2,label=INDIV))+
theme_minimal()+
theme(panel.grid=element_blank(),
panel.border=element_rect(fill="transparent"),
plot.title=element_text(hjust=0.5))+
geom_hline(yintercept=0,lty=2)+
geom_vline(xintercept=0,lty=2)+
geom_point(size=3,aes(col=LOCA))+
xlab(paste("PCA 1 (",round(pca$varprop[1]*100,2),"% )",sep=""))+
ylab(paste("PCA 2 (",round(pca$varprop[2]*100,2),"% )",sep=""))+
scale_colour_manual(name="Location",
values=c(color_med_atl[2],
color_med_atl[1],
color_med_atl[3],
color_med_atl[4]))
p1<-p
p<-ggplot(data=data_pca,aes(x=PC3,y=PC4,label=INDIV))+
theme_minimal()+
theme(panel.grid=element_blank(),
panel.border=element_rect(fill="transparent"),
plot.title=element_text(hjust=0.5))+
geom_hline(yintercept=0,lty=2)+
geom_vline(xintercept=0,lty=2)+
geom_point(size=3,aes(col=LOCA))+
xlab(paste("PCA 3 (",round(pca$varprop[3]*100,2),"% )",sep=""))+
ylab(paste("PCA 4 (",round(pca$varprop[4]*100,2),"% )",sep=""))+
scale_colour_manual(name="Location",
values=c(color_med_atl[2],
color_med_atl[1],
color_med_atl[3],
color_med_atl[4]))
p2<-p
data_varpop=data.frame(PC=factor(paste("P",seq(1,10),sep=""),levels=paste("P",seq(1,10),sep="")),VAR=pca$varprop[1:10])
pp<-ggplot(data_varpop,aes(x=PC,y=VAR))+
geom_bar(stat='identity',fill="dodgerblue2",alpha=0.25)+
theme_classic()+
xlab("Principal Component")+
ylab("Variation explained (%)")
```
```{r}
subplot(ggplotly(p1)%>% layout(legend = list(orientation = "h", x = 0.2, y =-0.15)), ggplotly(p2)%>%hide_legend(), ggplotly(pp)%>%hide_legend(), titleX=T,titleY=T,margin=0.035,widths=c(0.375,0.425,0.2),which_layout=1) %>% partial_bundle()
```
Row {.tabset data-height=50}
-----------------------
<center>
<font size="6">**Pruned unfiltered SNPS**</font>
</center>
Row {.tabset data-height=600}
-----------------------
### maf = 0
```{r}
pca=PCA_list$Prune_unfiltered$maf0[[1]]
data_pca=data.frame(INDIV=pca$sample.id,
PC1=pca$eigenvect[,1],
PC2=pca$eigenvect[,2],
PC3=pca$eigenvect[,3],
PC4=pca$eigenvect[,4],
LOCA=c(rep("Algarve",5),
rep("Bay of Biscay",5),
rep("Gulf of Lion",5),
rep("Costa Calida",5)))
color_med_atl=rev(brewer.pal(n=4,name="RdBu"))
p<-ggplot(data=data_pca,aes(x=PC1,y=PC2,label=INDIV))+
theme_minimal()+
theme(panel.grid=element_blank(),
panel.border=element_rect(fill="transparent"),
plot.title=element_text(hjust=0.5))+
geom_hline(yintercept=0,lty=2)+
geom_vline(xintercept=0,lty=2)+
geom_point(size=3,aes(col=LOCA))+
xlab(paste("PCA 1 (",round(pca$varprop[1]*100,2),"% )",sep=""))+
ylab(paste("PCA 2 (",round(pca$varprop[2]*100,2),"% )",sep=""))+
scale_colour_manual(name="Location",
values=c(color_med_atl[2],
color_med_atl[1],
color_med_atl[3],
color_med_atl[4]))
p1<-p
p<-ggplot(data=data_pca,aes(x=PC3,y=PC4,label=INDIV))+
theme_minimal()+
theme(panel.grid=element_blank(),
panel.border=element_rect(fill="transparent"),
plot.title=element_text(hjust=0.5))+
geom_hline(yintercept=0,lty=2)+
geom_vline(xintercept=0,lty=2)+
geom_point(size=3,aes(col=LOCA))+
xlab(paste("PCA 3 (",round(pca$varprop[3]*100,2),"% )",sep=""))+
ylab(paste("PCA 4 (",round(pca$varprop[4]*100,2),"% )",sep=""))+
scale_colour_manual(name="Location",
values=c(color_med_atl[2],
color_med_atl[1],
color_med_atl[3],
color_med_atl[4]))
p2<-p
data_varpop=data.frame(PC=factor(paste("P",seq(1,10),sep=""),levels=paste("P",seq(1,10),sep="")),VAR=pca$varprop[1:10])
pp<-ggplot(data_varpop,aes(x=PC,y=VAR))+
geom_bar(stat='identity',fill="dodgerblue2",alpha=0.25)+
theme_classic()+
xlab("Principal Component")+
ylab("Variation explained (%)")
```
```{r}
subplot(ggplotly(p1)%>% layout(legend = list(orientation = "h", x = 0.2, y =-0.15)), ggplotly(p2)%>%hide_legend(), ggplotly(pp)%>%hide_legend(), titleX=T,titleY=T,margin=0.035,widths=c(0.375,0.425,0.2),which_layout=1) %>% partial_bundle()
```
### maf = 0.05
```{r}
pca=PCA_list$Prune_unfiltered$maf0.05[[1]]
data_pca=data.frame(INDIV=pca$sample.id,
PC1=pca$eigenvect[,1],
PC2=pca$eigenvect[,2],
PC3=pca$eigenvect[,3],
PC4=pca$eigenvect[,4],
LOCA=c(rep("Algarve",5),
rep("Bay of Biscay",5),
rep("Gulf of Lion",5),
rep("Costa Calida",5)))
color_med_atl=rev(brewer.pal(n=4,name="RdBu"))
p<-ggplot(data=data_pca,aes(x=PC1,y=PC2,label=INDIV))+
theme_minimal()+
theme(panel.grid=element_blank(),
panel.border=element_rect(fill="transparent"),
plot.title=element_text(hjust=0.5))+
geom_hline(yintercept=0,lty=2)+
geom_vline(xintercept=0,lty=2)+
geom_point(size=3,aes(col=LOCA))+
xlab(paste("PCA 1 (",round(pca$varprop[1]*100,2),"% )",sep=""))+
ylab(paste("PCA 2 (",round(pca$varprop[2]*100,2),"% )",sep=""))+
scale_colour_manual(name="Location",
values=c(color_med_atl[2],
color_med_atl[1],
color_med_atl[3],
color_med_atl[4]))
p1<-p
p<-ggplot(data=data_pca,aes(x=PC3,y=PC4,label=INDIV))+
theme_minimal()+
theme(panel.grid=element_blank(),
panel.border=element_rect(fill="transparent"),
plot.title=element_text(hjust=0.5))+
geom_hline(yintercept=0,lty=2)+
geom_vline(xintercept=0,lty=2)+
geom_point(size=3,aes(col=LOCA))+
xlab(paste("PCA 3 (",round(pca$varprop[3]*100,2),"% )",sep=""))+
ylab(paste("PCA 4 (",round(pca$varprop[4]*100,2),"% )",sep=""))+
scale_colour_manual(name="Location",
values=c(color_med_atl[2],
color_med_atl[1],
color_med_atl[3],
color_med_atl[4]))
p2<-p
data_varpop=data.frame(PC=factor(paste("P",seq(1,10),sep=""),levels=paste("P",seq(1,10),sep="")),VAR=pca$varprop[1:10])
pp<-ggplot(data_varpop,aes(x=PC,y=VAR))+
geom_bar(stat='identity',fill="dodgerblue2",alpha=0.25)+
theme_classic()+
xlab("Principal Component")+
ylab("Variation explained (%)")
```
```{r}
subplot(ggplotly(p1)%>% layout(legend = list(orientation = "h", x = 0.2, y =-0.15)), ggplotly(p2)%>%hide_legend(), ggplotly(pp)%>%hide_legend(), titleX=T,titleY=T,margin=0.035,widths=c(0.375,0.425,0.2),which_layout=1) %>% partial_bundle()
```
### maf = 0.1
```{r}
pca=PCA_list$Prune_unfiltered$maf0.1[[1]]
data_pca=data.frame(INDIV=pca$sample.id,
PC1=pca$eigenvect[,1],
PC2=pca$eigenvect[,2],
PC3=pca$eigenvect[,3],
PC4=pca$eigenvect[,4],
LOCA=c(rep("Algarve",5),
rep("Bay of Biscay",5),
rep("Gulf of Lion",5),
rep("Costa Calida",5)))
color_med_atl=rev(brewer.pal(n=4,name="RdBu"))
p<-ggplot(data=data_pca,aes(x=PC1,y=PC2,label=INDIV))+
theme_minimal()+
theme(panel.grid=element_blank(),
panel.border=element_rect(fill="transparent"),
plot.title=element_text(hjust=0.5))+
geom_hline(yintercept=0,lty=2)+
geom_vline(xintercept=0,lty=2)+
geom_point(size=3,aes(col=LOCA))+
xlab(paste("PCA 1 (",round(pca$varprop[1]*100,2),"% )",sep=""))+
ylab(paste("PCA 2 (",round(pca$varprop[2]*100,2),"% )",sep=""))+
scale_colour_manual(name="Location",
values=c(color_med_atl[2],
color_med_atl[1],
color_med_atl[3],
color_med_atl[4]))
p1<-p
p<-ggplot(data=data_pca,aes(x=PC3,y=PC4,label=INDIV))+
theme_minimal()+
theme(panel.grid=element_blank(),
panel.border=element_rect(fill="transparent"),
plot.title=element_text(hjust=0.5))+
geom_hline(yintercept=0,lty=2)+
geom_vline(xintercept=0,lty=2)+
geom_point(size=3,aes(col=LOCA))+
xlab(paste("PCA 3 (",round(pca$varprop[3]*100,2),"% )",sep=""))+
ylab(paste("PCA 4 (",round(pca$varprop[4]*100,2),"% )",sep=""))+
scale_colour_manual(name="Location",
values=c(color_med_atl[2],
color_med_atl[1],
color_med_atl[3],
color_med_atl[4]))
p2<-p
data_varpop=data.frame(PC=factor(paste("P",seq(1,10),sep=""),levels=paste("P",seq(1,10),sep="")),VAR=pca$varprop[1:10])
pp<-ggplot(data_varpop,aes(x=PC,y=VAR))+
geom_bar(stat='identity',fill="dodgerblue2",alpha=0.25)+
theme_classic()+
xlab("Principal Component")+
ylab("Variation explained (%)")
```
```{r}
subplot(ggplotly(p1)%>% layout(legend = list(orientation = "h", x = 0.2, y =-0.15)), ggplotly(p2)%>%hide_legend(), ggplotly(pp)%>%hide_legend(), titleX=T,titleY=T,margin=0.035,widths=c(0.375,0.425,0.2),which_layout=1) %>% partial_bundle()
```
### maf = 0.15
```{r}
pca=PCA_list$Prune_unfiltered$maf0.15[[1]]
data_pca=data.frame(INDIV=pca$sample.id,
PC1=pca$eigenvect[,1],
PC2=pca$eigenvect[,2],
PC3=pca$eigenvect[,3],
PC4=pca$eigenvect[,4],
LOCA=c(rep("Algarve",5),
rep("Bay of Biscay",5),
rep("Gulf of Lion",5),
rep("Costa Calida",5)))
color_med_atl=rev(brewer.pal(n=4,name="RdBu"))
p<-ggplot(data=data_pca,aes(x=PC1,y=PC2,label=INDIV))+
theme_minimal()+
theme(panel.grid=element_blank(),
panel.border=element_rect(fill="transparent"),
plot.title=element_text(hjust=0.5))+
geom_hline(yintercept=0,lty=2)+
geom_vline(xintercept=0,lty=2)+
geom_point(size=3,aes(col=LOCA))+
xlab(paste("PCA 1 (",round(pca$varprop[1]*100,2),"% )",sep=""))+
ylab(paste("PCA 2 (",round(pca$varprop[2]*100,2),"% )",sep=""))+
scale_colour_manual(name="Location",
values=c(color_med_atl[2],
color_med_atl[1],
color_med_atl[3],
color_med_atl[4]))
p1<-p
p<-ggplot(data=data_pca,aes(x=PC3,y=PC4,label=INDIV))+
theme_minimal()+
theme(panel.grid=element_blank(),
panel.border=element_rect(fill="transparent"),
plot.title=element_text(hjust=0.5))+
geom_hline(yintercept=0,lty=2)+
geom_vline(xintercept=0,lty=2)+
geom_point(size=3,aes(col=LOCA))+
xlab(paste("PCA 3 (",round(pca$varprop[3]*100,2),"% )",sep=""))+
ylab(paste("PCA 4 (",round(pca$varprop[4]*100,2),"% )",sep=""))+
scale_colour_manual(name="Location",
values=c(color_med_atl[2],
color_med_atl[1],
color_med_atl[3],
color_med_atl[4]))
p2<-p
data_varpop=data.frame(PC=factor(paste("P",seq(1,10),sep=""),levels=paste("P",seq(1,10),sep="")),VAR=pca$varprop[1:10])
pp<-ggplot(data_varpop,aes(x=PC,y=VAR))+
geom_bar(stat='identity',fill="dodgerblue2",alpha=0.25)+
theme_classic()+
xlab("Principal Component")+
ylab("Variation explained (%)")
```
```{r}
subplot(ggplotly(p1)%>% layout(legend = list(orientation = "h", x = 0.2, y =-0.15)), ggplotly(p2)%>%hide_legend(), ggplotly(pp)%>%hide_legend(), titleX=T,titleY=T,margin=0.035,widths=c(0.375,0.425,0.2),which_layout=1) %>% partial_bundle()
```
### maf = 0.20
```{r}
pca=PCA_list$Prune_unfiltered$maf0.2[[1]]
data_pca=data.frame(INDIV=pca$sample.id,
PC1=pca$eigenvect[,1],
PC2=pca$eigenvect[,2],
PC3=pca$eigenvect[,3],
PC4=pca$eigenvect[,4],
LOCA=c(rep("Algarve",5),
rep("Bay of Biscay",5),
rep("Gulf of Lion",5),
rep("Costa Calida",5)))
color_med_atl=rev(brewer.pal(n=4,name="RdBu"))
p<-ggplot(data=data_pca,aes(x=PC1,y=PC2,label=INDIV))+
theme_minimal()+
theme(panel.grid=element_blank(),
panel.border=element_rect(fill="transparent"),
plot.title=element_text(hjust=0.5))+
geom_hline(yintercept=0,lty=2)+
geom_vline(xintercept=0,lty=2)+
geom_point(size=3,aes(col=LOCA))+
xlab(paste("PCA 1 (",round(pca$varprop[1]*100,2),"% )",sep=""))+
ylab(paste("PCA 2 (",round(pca$varprop[2]*100,2),"% )",sep=""))+
scale_colour_manual(name="Location",
values=c(color_med_atl[2],
color_med_atl[1],
color_med_atl[3],
color_med_atl[4]))
p1<-p
p<-ggplot(data=data_pca,aes(x=PC3,y=PC4,label=INDIV))+
theme_minimal()+
theme(panel.grid=element_blank(),
panel.border=element_rect(fill="transparent"),
plot.title=element_text(hjust=0.5))+
geom_hline(yintercept=0,lty=2)+
geom_vline(xintercept=0,lty=2)+
geom_point(size=3,aes(col=LOCA))+
xlab(paste("PCA 3 (",round(pca$varprop[3]*100,2),"% )",sep=""))+
ylab(paste("PCA 4 (",round(pca$varprop[4]*100,2),"% )",sep=""))+
scale_colour_manual(name="Location",
values=c(color_med_atl[2],
color_med_atl[1],
color_med_atl[3],
color_med_atl[4]))
p2<-p
data_varpop=data.frame(PC=factor(paste("P",seq(1,10),sep=""),levels=paste("P",seq(1,10),sep="")),VAR=pca$varprop[1:10])
pp<-ggplot(data_varpop,aes(x=PC,y=VAR))+
geom_bar(stat='identity',fill="dodgerblue2",alpha=0.25)+
theme_classic()+
xlab("Principal Component")+
ylab("Variation explained (%)")
```
```{r}
subplot(ggplotly(p1)%>% layout(legend = list(orientation = "h", x = 0.2, y =-0.15)), ggplotly(p2)%>%hide_legend(), ggplotly(pp)%>%hide_legend(), titleX=T,titleY=T,margin=0.035,widths=c(0.375,0.425,0.2),which_layout=1) %>% partial_bundle()
```
### maf = 0.25
```{r}
pca=PCA_list$Prune_unfiltered$maf0.25[[1]]
data_pca=data.frame(INDIV=pca$sample.id,
PC1=pca$eigenvect[,1],
PC2=pca$eigenvect[,2],
PC3=pca$eigenvect[,3],
PC4=pca$eigenvect[,4],
LOCA=c(rep("Algarve",5),
rep("Bay of Biscay",5),
rep("Gulf of Lion",5),
rep("Costa Calida",5)))
color_med_atl=rev(brewer.pal(n=4,name="RdBu"))
p<-ggplot(data=data_pca,aes(x=PC1,y=PC2,label=INDIV))+
theme_minimal()+
theme(panel.grid=element_blank(),
panel.border=element_rect(fill="transparent"),
plot.title=element_text(hjust=0.5))+
geom_hline(yintercept=0,lty=2)+
geom_vline(xintercept=0,lty=2)+
geom_point(size=3,aes(col=LOCA))+
xlab(paste("PCA 1 (",round(pca$varprop[1]*100,2),"% )",sep=""))+
ylab(paste("PCA 2 (",round(pca$varprop[2]*100,2),"% )",sep=""))+
scale_colour_manual(name="Location",
values=c(color_med_atl[2],
color_med_atl[1],
color_med_atl[3],
color_med_atl[4]))
p1<-p
p<-ggplot(data=data_pca,aes(x=PC3,y=PC4,label=INDIV))+
theme_minimal()+
theme(panel.grid=element_blank(),
panel.border=element_rect(fill="transparent"),
plot.title=element_text(hjust=0.5))+
geom_hline(yintercept=0,lty=2)+
geom_vline(xintercept=0,lty=2)+
geom_point(size=3,aes(col=LOCA))+
xlab(paste("PCA 3 (",round(pca$varprop[3]*100,2),"% )",sep=""))+
ylab(paste("PCA 4 (",round(pca$varprop[4]*100,2),"% )",sep=""))+
scale_colour_manual(name="Location",
values=c(color_med_atl[2],
color_med_atl[1],
color_med_atl[3],
color_med_atl[4]))
p2<-p
data_varpop=data.frame(PC=factor(paste("P",seq(1,10),sep=""),levels=paste("P",seq(1,10),sep="")),VAR=pca$varprop[1:10])
pp<-ggplot(data_varpop,aes(x=PC,y=VAR))+
geom_bar(stat='identity',fill="dodgerblue2",alpha=0.25)+
theme_classic()+
xlab("Principal Component")+
ylab("Variation explained (%)")
```
```{r}
subplot(ggplotly(p1)%>% layout(legend = list(orientation = "h", x = 0.2, y =-0.15)), ggplotly(p2)%>%hide_legend(), ggplotly(pp)%>%hide_legend(), titleX=T,titleY=T,margin=0.035,widths=c(0.375,0.425,0.2),which_layout=1) %>% partial_bundle()
```
### maf = 0.30
```{r}
pca=PCA_list$Prune_unfiltered$maf0.3[[1]]
data_pca=data.frame(INDIV=pca$sample.id,
PC1=pca$eigenvect[,1],
PC2=pca$eigenvect[,2],
PC3=pca$eigenvect[,3],
PC4=pca$eigenvect[,4],
LOCA=c(rep("Algarve",5),
rep("Bay of Biscay",5),
rep("Gulf of Lion",5),
rep("Costa Calida",5)))
color_med_atl=rev(brewer.pal(n=4,name="RdBu"))
p<-ggplot(data=data_pca,aes(x=PC1,y=PC2,label=INDIV))+
theme_minimal()+
theme(panel.grid=element_blank(),
panel.border=element_rect(fill="transparent"),
plot.title=element_text(hjust=0.5))+
geom_hline(yintercept=0,lty=2)+
geom_vline(xintercept=0,lty=2)+
geom_point(size=3,aes(col=LOCA))+
xlab(paste("PCA 1 (",round(pca$varprop[1]*100,2),"% )",sep=""))+
ylab(paste("PCA 2 (",round(pca$varprop[2]*100,2),"% )",sep=""))+
scale_colour_manual(name="Location",
values=c(color_med_atl[2],
color_med_atl[1],
color_med_atl[3],
color_med_atl[4]))
p1<-p
p<-ggplot(data=data_pca,aes(x=PC3,y=PC4,label=INDIV))+
theme_minimal()+
theme(panel.grid=element_blank(),
panel.border=element_rect(fill="transparent"),
plot.title=element_text(hjust=0.5))+
geom_hline(yintercept=0,lty=2)+
geom_vline(xintercept=0,lty=2)+
geom_point(size=3,aes(col=LOCA))+
xlab(paste("PCA 3 (",round(pca$varprop[3]*100,2),"% )",sep=""))+
ylab(paste("PCA 4 (",round(pca$varprop[4]*100,2),"% )",sep=""))+
scale_colour_manual(name="Location",
values=c(color_med_atl[2],
color_med_atl[1],
color_med_atl[3],
color_med_atl[4]))
p2<-p
data_varpop=data.frame(PC=factor(paste("P",seq(1,10),sep=""),levels=paste("P",seq(1,10),sep="")),VAR=pca$varprop[1:10])
pp<-ggplot(data_varpop,aes(x=PC,y=VAR))+
geom_bar(stat='identity',fill="dodgerblue2",alpha=0.25)+
theme_classic()+
xlab("Principal Component")+
ylab("Variation explained (%)")
```
```{r}
subplot(ggplotly(p1)%>% layout(legend = list(orientation = "h", x = 0.2, y =-0.15)), ggplotly(p2)%>%hide_legend(), ggplotly(pp)%>%hide_legend(), titleX=T,titleY=T,margin=0.035,widths=c(0.375,0.425,0.2),which_layout=1) %>% partial_bundle()
```
### maf = 0.35
```{r}
pca=PCA_list$Prune_unfiltered$maf0.35[[1]]
data_pca=data.frame(INDIV=pca$sample.id,
PC1=pca$eigenvect[,1],
PC2=pca$eigenvect[,2],
PC3=pca$eigenvect[,3],
PC4=pca$eigenvect[,4],
LOCA=c(rep("Algarve",5),
rep("Bay of Biscay",5),
rep("Gulf of Lion",5),
rep("Costa Calida",5)))
color_med_atl=rev(brewer.pal(n=4,name="RdBu"))
p<-ggplot(data=data_pca,aes(x=PC1,y=PC2,label=INDIV))+
theme_minimal()+
theme(panel.grid=element_blank(),
panel.border=element_rect(fill="transparent"),
plot.title=element_text(hjust=0.5))+
geom_hline(yintercept=0,lty=2)+
geom_vline(xintercept=0,lty=2)+
geom_point(size=3,aes(col=LOCA))+
xlab(paste("PCA 1 (",round(pca$varprop[1]*100,2),"% )",sep=""))+
ylab(paste("PCA 2 (",round(pca$varprop[2]*100,2),"% )",sep=""))+
scale_colour_manual(name="Location",
values=c(color_med_atl[2],
color_med_atl[1],
color_med_atl[3],
color_med_atl[4]))
p1<-p
p<-ggplot(data=data_pca,aes(x=PC3,y=PC4,label=INDIV))+
theme_minimal()+
theme(panel.grid=element_blank(),
panel.border=element_rect(fill="transparent"),
plot.title=element_text(hjust=0.5))+
geom_hline(yintercept=0,lty=2)+
geom_vline(xintercept=0,lty=2)+
geom_point(size=3,aes(col=LOCA))+
xlab(paste("PCA 3 (",round(pca$varprop[3]*100,2),"% )",sep=""))+
ylab(paste("PCA 4 (",round(pca$varprop[4]*100,2),"% )",sep=""))+
scale_colour_manual(name="Location",
values=c(color_med_atl[2],
color_med_atl[1],
color_med_atl[3],
color_med_atl[4]))
p2<-p
data_varpop=data.frame(PC=factor(paste("P",seq(1,10),sep=""),levels=paste("P",seq(1,10),sep="")),VAR=pca$varprop[1:10])
pp<-ggplot(data_varpop,aes(x=PC,y=VAR))+
geom_bar(stat='identity',fill="dodgerblue2",alpha=0.25)+
theme_classic()+
xlab("Principal Component")+
ylab("Variation explained (%)")
```
```{r}
subplot(ggplotly(p1)%>% layout(legend = list(orientation = "h", x = 0.2, y =-0.15)), ggplotly(p2)%>%hide_legend(), ggplotly(pp)%>%hide_legend(), titleX=T,titleY=T,margin=0.035,widths=c(0.375,0.425,0.2),which_layout=1) %>% partial_bundle()
```
### maf = 0.40
```{r}
pca=PCA_list$Prune_unfiltered$maf0.4[[1]]
data_pca=data.frame(INDIV=pca$sample.id,
PC1=pca$eigenvect[,1],
PC2=pca$eigenvect[,2],
PC3=pca$eigenvect[,3],
PC4=pca$eigenvect[,4],
LOCA=c(rep("Algarve",5),
rep("Bay of Biscay",5),
rep("Gulf of Lion",5),
rep("Costa Calida",5)))
color_med_atl=rev(brewer.pal(n=4,name="RdBu"))
p<-ggplot(data=data_pca,aes(x=PC1,y=PC2,label=INDIV))+
theme_minimal()+
theme(panel.grid=element_blank(),
panel.border=element_rect(fill="transparent"),
plot.title=element_text(hjust=0.5))+
geom_hline(yintercept=0,lty=2)+
geom_vline(xintercept=0,lty=2)+
geom_point(size=3,aes(col=LOCA))+
xlab(paste("PCA 1 (",round(pca$varprop[1]*100,2),"% )",sep=""))+
ylab(paste("PCA 2 (",round(pca$varprop[2]*100,2),"% )",sep=""))+
scale_colour_manual(name="Location",
values=c(color_med_atl[2],
color_med_atl[1],
color_med_atl[3],
color_med_atl[4]))
p1<-p
p<-ggplot(data=data_pca,aes(x=PC3,y=PC4,label=INDIV))+
theme_minimal()+
theme(panel.grid=element_blank(),
panel.border=element_rect(fill="transparent"),
plot.title=element_text(hjust=0.5))+
geom_hline(yintercept=0,lty=2)+
geom_vline(xintercept=0,lty=2)+
geom_point(size=3,aes(col=LOCA))+
xlab(paste("PCA 3 (",round(pca$varprop[3]*100,2),"% )",sep=""))+
ylab(paste("PCA 4 (",round(pca$varprop[4]*100,2),"% )",sep=""))+
scale_colour_manual(name="Location",
values=c(color_med_atl[2],
color_med_atl[1],
color_med_atl[3],
color_med_atl[4]))
p2<-p
data_varpop=data.frame(PC=factor(paste("P",seq(1,10),sep=""),levels=paste("P",seq(1,10),sep="")),VAR=pca$varprop[1:10])
pp<-ggplot(data_varpop,aes(x=PC,y=VAR))+
geom_bar(stat='identity',fill="dodgerblue2",alpha=0.25)+
theme_classic()+
xlab("Principal Component")+
ylab("Variation explained (%)")
```
```{r}
subplot(ggplotly(p1)%>% layout(legend = list(orientation = "h", x = 0.2, y =-0.15)), ggplotly(p2)%>%hide_legend(), ggplotly(pp)%>%hide_legend(), titleX=T,titleY=T,margin=0.035,widths=c(0.375,0.425,0.2),which_layout=1) %>% partial_bundle()
```
### maf = 0.45
```{r}
pca=PCA_list$Prune_unfiltered$maf0.45[[1]]
data_pca=data.frame(INDIV=pca$sample.id,
PC1=pca$eigenvect[,1],
PC2=pca$eigenvect[,2],
PC3=pca$eigenvect[,3],
PC4=pca$eigenvect[,4],
LOCA=c(rep("Algarve",5),
rep("Bay of Biscay",5),
rep("Gulf of Lion",5),
rep("Costa Calida",5)))
color_med_atl=rev(brewer.pal(n=4,name="RdBu"))
p<-ggplot(data=data_pca,aes(x=PC1,y=PC2,label=INDIV))+
theme_minimal()+
theme(panel.grid=element_blank(),
panel.border=element_rect(fill="transparent"),
plot.title=element_text(hjust=0.5))+
geom_hline(yintercept=0,lty=2)+
geom_vline(xintercept=0,lty=2)+
geom_point(size=3,aes(col=LOCA))+
xlab(paste("PCA 1 (",round(pca$varprop[1]*100,2),"% )",sep=""))+
ylab(paste("PCA 2 (",round(pca$varprop[2]*100,2),"% )",sep=""))+
scale_colour_manual(name="Location",
values=c(color_med_atl[2],
color_med_atl[1],
color_med_atl[3],
color_med_atl[4]))
p1<-p
p<-ggplot(data=data_pca,aes(x=PC3,y=PC4,label=INDIV))+
theme_minimal()+
theme(panel.grid=element_blank(),
panel.border=element_rect(fill="transparent"),
plot.title=element_text(hjust=0.5))+
geom_hline(yintercept=0,lty=2)+
geom_vline(xintercept=0,lty=2)+
geom_point(size=3,aes(col=LOCA))+
xlab(paste("PCA 3 (",round(pca$varprop[3]*100,2),"% )",sep=""))+
ylab(paste("PCA 4 (",round(pca$varprop[4]*100,2),"% )",sep=""))+
scale_colour_manual(name="Location",
values=c(color_med_atl[2],
color_med_atl[1],
color_med_atl[3],
color_med_atl[4]))
p2<-p
data_varpop=data.frame(PC=factor(paste("P",seq(1,10),sep=""),levels=paste("P",seq(1,10),sep="")),VAR=pca$varprop[1:10])
pp<-ggplot(data_varpop,aes(x=PC,y=VAR))+
geom_bar(stat='identity',fill="dodgerblue2",alpha=0.25)+
theme_classic()+
xlab("Principal Component")+
ylab("Variation explained (%)")
```
```{r}
subplot(ggplotly(p1)%>% layout(legend = list(orientation = "h", x = 0.2, y =-0.15)), ggplotly(p2)%>%hide_legend(), ggplotly(pp)%>%hide_legend(), titleX=T,titleY=T,margin=0.035,widths=c(0.375,0.425,0.2),which_layout=1) %>% partial_bundle()
```
### maf = 0.50
```{r}
pca=PCA_list$Prune_unfiltered$maf0.5[[1]]
data_pca=data.frame(INDIV=pca$sample.id,
PC1=pca$eigenvect[,1],
PC2=pca$eigenvect[,2],
PC3=pca$eigenvect[,3],
PC4=pca$eigenvect[,4],
LOCA=c(rep("Algarve",5),
rep("Bay of Biscay",5),
rep("Gulf of Lion",5),
rep("Costa Calida",5)))
color_med_atl=rev(brewer.pal(n=4,name="RdBu"))
p<-ggplot(data=data_pca,aes(x=PC1,y=PC2,label=INDIV))+
theme_minimal()+
theme(panel.grid=element_blank(),
panel.border=element_rect(fill="transparent"),
plot.title=element_text(hjust=0.5))+
geom_hline(yintercept=0,lty=2)+
geom_vline(xintercept=0,lty=2)+
geom_point(size=3,aes(col=LOCA))+
xlab(paste("PCA 1 (",round(pca$varprop[1]*100,2),"% )",sep=""))+
ylab(paste("PCA 2 (",round(pca$varprop[2]*100,2),"% )",sep=""))+
scale_colour_manual(name="Location",
values=c(color_med_atl[2],
color_med_atl[1],
color_med_atl[3],
color_med_atl[4]))
p1<-p
p<-ggplot(data=data_pca,aes(x=PC3,y=PC4,label=INDIV))+
theme_minimal()+
theme(panel.grid=element_blank(),
panel.border=element_rect(fill="transparent"),
plot.title=element_text(hjust=0.5))+
geom_hline(yintercept=0,lty=2)+
geom_vline(xintercept=0,lty=2)+
geom_point(size=3,aes(col=LOCA))+
xlab(paste("PCA 3 (",round(pca$varprop[3]*100,2),"% )",sep=""))+
ylab(paste("PCA 4 (",round(pca$varprop[4]*100,2),"% )",sep=""))+
scale_colour_manual(name="Location",
values=c(color_med_atl[2],
color_med_atl[1],
color_med_atl[3],
color_med_atl[4]))
p2<-p
data_varpop=data.frame(PC=factor(paste("P",seq(1,10),sep=""),levels=paste("P",seq(1,10),sep="")),VAR=pca$varprop[1:10])
pp<-ggplot(data_varpop,aes(x=PC,y=VAR))+
geom_bar(stat='identity',fill="dodgerblue2",alpha=0.25)+
theme_classic()+
xlab("Principal Component")+
ylab("Variation explained (%)")
```
```{r}
subplot(ggplotly(p1)%>% layout(legend = list(orientation = "h", x = 0.2, y =-0.15)), ggplotly(p2)%>%hide_legend(), ggplotly(pp)%>%hide_legend(), titleX=T,titleY=T,margin=0.035,widths=c(0.375,0.425,0.2),which_layout=1) %>% partial_bundle()
```
Packages used {data-icon="fa-map"}
=======================================================================
```{r}
installed.packages()[names(sessionInfo()$otherPkgs), "Version"]
```